Running tests with mayapy.exe give: "ImportError: No module named os"


Strange things started happen recently. I'm pretty sure I was able to run the unittests before, but somehow it just stopped working.

When trying to run my tests I'm getting the following error:
"C:\Program Files\Autodesk\Maya2014\bin\mayapy.exe" "C:\Program Files (x86)\JetBrains\PyCharm 4.0.1\helpers\pycharm\" E:\Projects\nodex\ true
Testing started at 23:35 ...
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.1\helpers\pycharm\", line 17, in <module>
    os = import_system_module("os")
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.1\helpers\pycharm\", line 33, in import_system_module
    f, filename, desc = imp.find_module(name)
ImportError: No module named os

Process finished with exit code 1

When doing 'import os' in my code it just runs fine so I'm not sure what is messing up the interpreter.
Note that mayapy.exe is the python interpreter that comes with Autodesk Maya.

What would be the next step towards debugging what's going on here? (And solving this!)
Also reinstalled Pycharm just to be sure, though it didn't do the trick.


  • EDIT*: Just checked with another version of Maya (2015) and it seemed raise the same error (same machine).

Funny thing is that:
import os

Above works as expected.
Yet the following results in an "ImportError":

import imp
1 comment
Comment actions Permalink
Here's some more information.

Still not sure how I would use that to fix this particular issue on my end.

Please sign in to leave a comment.