View Full Version : Install pywin32 for mayapy
12 December 2010, 03:08 PM
I use mayapy.exe from maya2010 as my python interpreter. I also have a c:\python25 installation which I don't use, some app put it there and might need it.
My pythonhome is set to C:\Program Files\Autodesk\Maya2010\Python\.
I downloaded pywin32, and ran
mayapy setup.py -q install
It returned 0 errors and created a build directory.
Now I wrote this script
, but when I ran it with mayapy, it returned
Traceback (most recent call last):
File "helloWin32.py", line 2, in <module>
ImportError: No module named win32api
I added the installation dir c:\pywin32 to pythonpath, but it didn't work.
I'm not sure what's the problem, and because I a newbie to python, I'm not sure what to look for. Should there be a file win32api.py or win32api.pyd somewhere that should have been copied to the python site in maya? What about a .pth file?
On the whole computer there's no such file as win32api.pyd, but there is a win32api.py under: C:\pywin32\isapi\test\build\bdist.win32\winexe\temp\
When I copied it to c:\pywin32 (which is in pythonpath) it complained: "ImportError: DLL load failed: The specified module could not be found.". I assume there are also dlls that should be compiled but I can't find any in the build directory.
When I installed pymel, I just downloaded it, and added it to pythonpath. There I suppose it needs directories and not a specific file.
12 December 2010, 03:12 PM
Because of the pythonhome environment variable, is there an easy way to work with two python installations that won't collide with each other?
12 December 2010, 07:27 PM
Maybe a stupid question, but are you sure that you dont mix 32bit and 64bit?
12 December 2010, 07:35 PM
No question is stupid in this context. My OS is WinXP 32 bit, and maya version is also 32bits. The source code which I installed its setup.py should be platform independent.
12 December 2010, 01:37 PM
Kind of resolved:
I installed python27, and when I ran setup.py with it, it screamed about vcvarsall.bat. It looks for vs2008, but I had 'only' 2005 & 2010. I tried to fool it by setting VS90COMNTOOLS to my other version, but of course microsoft compiler can't be compatible from version to version...
Finally I found that besides the default downloaded src, there's a files option in the sourceforge project, which contains binaries for all version. I installed python26, and installed pywin32 binary for it. Then I add the win32 dir in its site to pythonpath, so mayapy could find it.
All works well, the only mystery is why mayapy didn't scream about setup.py not finding vsvarsall.bat and returned error None like everything was alright. I assumed maya simply don't want users to uses mayapy to anything else, and prevent installing packages, but forgot to warn about it...
12 December 2010, 10:13 PM
I have similar python setup as yours. At work, we have pywin32 installed to the standalone python interpreter, so if you need to reference (import) them in mayapy, you will need to add following paths in your sys.path list:
this is all based on the assumption that your pywin32 actually works with your mayapy.
12 December 2010, 10:13 AM
Exactly as I described in my previous post. It means I'm on the right track.
12 December 2010, 10:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.