0

When I try to import wxPython from Maya (or mayapy), I get an import error:

[/c] ==> mayapy
Python 2.6.4 (r264:75706, May 19 2011, 13:53:43) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Program Files\Autodesk\Maya2013\Python\lib\site-packages\wx-3.0-msw\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "c:\Program Files\Autodesk\Maya2013\Python\lib\site-packages\wx-3.0-msw\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: The specified module could not be found.

Question:

How do I make wxPython work with Maya's Python installation?

Context:

I use PyQt, PySide and Tkinter for my UI development with Maya Python. I want to use wxPython just to try it out. I installed the version of wxPython that was meant for Python 2.6/Win64. It is installed in Maya's Python folder: C:\Program Files\Autodesk\Maya2013\Python\lib\site-packages\

I tried installing wx for a standard installation of Python 2.6 and it works fine. That is the reason I am posting this question; I am looking for a solution for why this is happening only for the Maya Python installation and not the other standard Python installation that I have.

I am using:

  • Maya version: 2013
  • Maya Python version: 2.6.4
  • OS: Windows 7, 64-bit.

Thank you for any help or suggestions you can give.

kartikg3
  • 2,590
  • 1
  • 16
  • 23

1 Answers1

1

There are a couple of reasons you could be getting that message. Some have reported that this happens if you install a 64-bit wxPython to a 32-bit Python (or vice-versa), although I personally don't know how you could do that. That is something to check though as if you have a 64-bit vs 32-bit mismatch, you will definitely have issues.

The other more likely issue is that you need to install a Microsoft redistributable so that you have the correct DLL that wxPython needs.

Community
  • 1
  • 1
Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88
  • If it needed the Microsoft redistributable installation/re-installation, would it not have NOT worked for Standard Python 2.6? The strange thing is, it works for standard Python installations. Just not the Maya one. Also, I do have the MS redis installed. Thanks for the tips though! – kartikg3 Dec 15 '14 at 20:22
  • When I run my Maya Python, it starts up saying that it is `[MSC v.1600 64 bit (AMD64)] on win32`. Why is there `win32` here, when I know that this is a win64 machine? – kartikg3 Dec 15 '14 at 20:24
  • 1
    I don't know. I've never used Maya Python. But if Maya Python is 32-bit and you installed wxPython 64-bit, then that's your issue. You might need to ask their support group about that. – Mike Driscoll Dec 15 '14 at 21:57
  • 1
    @kartikg3 win32 is the name of the subsystem of windows. Mayas python is 64-bit, but it reads different directiory paths than normal python so the dlls need to be relocated correctly or the opath environment changed. – joojaa Dec 16 '14 at 08:54
  • Thanks @joojaa. That was good info. Would you know which environment var I should be checking? – kartikg3 Dec 16 '14 at 11:31