Question

When my IronPython program gets to the line

import wx

I get this message:

A first chance exception of type
'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll

Additional information: No module named _core_

although I do have the file wx\_core_.pyd. Also, before attempting the import, I have the lines:

sys.path.append('c:\\Python24\\Lib\\site-packages')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wx')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wx\\lib')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wxpython\\lib')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wxaddons')

which I hoped would let IronPython find everything it needed.

Was it helpful?

Solution

No, this won't work. Wx bindings (like most other "python bindings") are actually compiled against CPython.

In this regards they are not just packages on sys.path to be found, as you have tried. They actually depend on CPython itself. This rather dry document explains the process.

Note: There was a mission by some of the crew at Resolver Systems to allow you to use CPython bindings with IronPython (called IronClad) but this is in its early stages, and I think they will concentrate on getting things like Numpy working first, GUI toolkits will always be the last, and hardest.

OTHER TIPS

While wxPython is unavailable for the reasons listed by @Ali, you may want to take a look at wx.NET. You could use IronPython to call these assemblies instead, and it should be cross-platform (I'm assuming that's what you're after, or you would just use WinForms). If all you're looking for is API compatibility, I think you're out of luck :(

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top