Module object has no attribute - PyCharm Error, command line is ok


I am getting the classic 'module' object has no attribute "module" error in PyCharm. It must be a setting in PyCharm as I can:

1. Run the script from a command shell when navigating to the folder:

2. Run the script in PyCharm *if* and only if I have "Add content roots to PYTHONPATH" unchecked.

3. However, if I have "Add Content roots to PYTHONPATH" checked, I receive the following error:

I am fairly new to Python, and I am interpreting this as saying that there is no 'py_version' function (class?) in the API module.

Here is my project structure and code snippit:


Can someone kindly explain what is happening and why in the command shell it will detect the adapter and in PyCharm is will not detect the adapter if I have "Add Content roots to PYTHONPATH" checked?

I am glad that I can get it to work in PyCharm, but I would like to understand why.




This might be a long shot, but the first thing I would check is if you have any object named 'module' defined anywhere in your code? It's possible that you're running into naming conflict with Python's inbuilt object, where modifying PYTHONPATH can cause your module take priority over inbuilt module.



I have the exact same issue with the exact Aardvark probe with PyCharm.

I am highly interested in knowing how did you fix this problem!

Thanks for your help!


No, I had put it aside and have never revisited the issue. I discussed this with Total Phase support, but never truly came to a solution. If I recall a couple of years ago, it was a folder structure problem, but I simply don't have the time to debug it now. 


Thanks for the reply!

I think I've found the root cause, at least in my situation.

I placed the driver and wrapper from Total Phase (files and in my project in a folder named aardvark.

It seems there was a collision another object named also aardvark in Total Phase python files because when I renamed the folder to aardvarkapi, the problem disappeared.

I hope this will help somebody in the future!


Please sign in to leave a comment.