Ok, got something annoying again, and solved it. And to let it be recorded in the great internet of ours, I'm writing down the solution that I've found for it.
You hope to be able to setup PyCharm for some fancy unittests including PyMel or Maya. You setup mayapy as it is shown here and you don't want to debug it remotely as shown there, but run your tests right inside PyCharm with mayapy. You've set up your project interpreter as mayapy, and then hit Ctrl+Shift+F10, and gues what you've got this error message:
When you further inspect the error and the code that generates the error (pycharm_run_utils.py) you see that PyCharm is trying to use the
To be clear about the solution, unzip the python2x.zip file somewhere that you have write permission and in PyCharm:
I hope it will save some of your hours and hairs!
The Problem
You hope to be able to setup PyCharm for some fancy unittests including PyMel or Maya. You setup mayapy as it is shown here and you don't want to debug it remotely as shown there, but run your tests right inside PyCharm with mayapy. You've set up your project interpreter as mayapy, and then hit Ctrl+Shift+F10, and gues what you've got this error message:
Traceback (most recent call last): File "/home/eoyilmaz/.local/share/pycharm-3.0.2/helpers/pycharm/utrunner.py", line 17, inWhat!!! you say,os = import_system_module("os") File "/home/eoyilmaz/.local/share/pycharm-3.0.2/helpers/pycharm/pycharm_run_utils.py", line 33, in import_system_module f, filename, desc = imp.find_module(name) ImportError: No module named os
ImportError: No module named os
, "os" is one of the built-in module how come you can not find it.The Solution
When you further inspect the error and the code that generates the error (pycharm_run_utils.py) you see that PyCharm is trying to use the
imp
module to find out the package paths, that's very cool but it seems that it is not working with zipped modules. Yes, the zipped modules, like the one that is shipping with Maya. The problem is the python2x.zip file, imp module can not find anything inside this zip file. Then at the moment you've recognized that and get happier, you start to thinking about the last 6 hours you've lost finding this.To be clear about the solution, unzip the python2x.zip file somewhere that you have write permission and in PyCharm:
- Go to "Settings->Project Interpreter->Python Interpreters"
- Select maypy
- Select "Paths" tab
- Remove these (if exists):
- /usr/autodesk/maya/lib/
- /usr/autodesk/maya/lib/python2x.zip
- I didn't remove these, and it was still working:
- /usr/autodesk/maya/lib/python2.x/config/
- /usr/autodesk/maya/lib/python2.x/site-packages
- /usr/autodesk/maya/lib/python2.x/
- Add the path that you've extracted the python2x.zip file, like this:
- /home/eoyilmaz/Documents/development/MayaPythonLib/python27/
I hope it will save some of your hours and hairs!
Comments