Search code examples
pythonmaya

maya2008 win32api 64 bit python


How is it possible to run import win32api successfully on a 64bit maya version 2008?

The following error occurs:

Error: No module named win32api
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named win32api

I need to get mouse cursor position in python so that I can place window exactly in that position. Is there any other way to get it?

Best regards,

kNish


Solution

  • Maya uses its own Python installation. You need to add the path where pywin32 is installed by one way or another ... you can create a .pth file in

    C:\Program Files\Autodesk\Maya2009\Python\Lib\site-packages\

    Also, like Adam pointed out, make sure you have the 64 bit pywin32 installed.

    Here's an article talking about this subject:

    http://www.rtrowbridge.com/blog/2008/11/27/maya-python-import-scripts/

    Edit:

    Yeah indeed I think they don't provide PyWin32 for Python25 x64:

    Available for AMD64 versions of Windows for Python 2.6 and later (support for Python 2.5 is just too hard, sorry). Lots of help from Roger, Steve Yin and Sidnei da Silva.

    http://sourceforge.net/project/shownotes.php?release_id=603349