August 30th, 2004, 10:28 PM
import error on linux
I have the following line in my code:-
it runs fine on my windows machine but when i try to run it on linux box it says module doesnt have _core .
But runs fine when i change _core to core.
Any idea why???
August 31st, 2004, 03:16 AM
I can't check wx at the moment so these are general comments...
Your code calling
does not sound portable. _ is mostly used to indicate a private attribute or method (in this case a private module) to be used by the package only so almost by definition it is not guaranteed to be available for external access across platforms.
Perhaps it would be best to raise your own exception or use a higher level interface in a publicly accessible module?
Are the versions of wxPython the same on each platform? I know there have to been many features/changes introduced between releases.
August 31st, 2004, 10:46 AM
In wxPython under windows, there are 2 core's you could be referring to. The plain wx.core is a .py file that was generated using SWIG to provide an interface to the OTHER core: wx._core. wx._core is a .pyd file. In the windows install, the core.py and the _core.pyd are placed in the same directory (\site-packages\wx) by default. So this should shed some light on what you are referring to when you say "wx._core" vs. "wx.core" in windows.
Originally Posted by wx_uab
Unfortunately, I haven't used wxPython under Linux yet, so I can't tell you for certain what is happening with the core.py file and the _core.pyd files. But you can check that out for yourself.
All that said, I would suggest simply using "wx.core.PyAssertionError". This works under windows, and apparently works for you under linux. There is no reason you should need to access wx._core vs. wx.core unless you were really sure of what you were doing. Hence the "_" as Grim mentioned.
Last edited by p4j; August 31st, 2004 at 10:56 AM.
Reason: minor changes