Well, I have some rather strange behavior in one of my projects, and I hope someone will tell me why. My file structure is as follows:
MainApp.py res/ __init__.py elements/ __init__.py MainFrame.py
Inside MainFrame.py, I defined a class called RPMWindow that extends wx.Frame.
In MainApp.py, this works:
from res.elements.MainFrame import *
And this is not so:
from res.elements.MainFrame import RPMWindow
I understand that importing a wild card doesn’t hurt anything, but I'm more interested in why named import fails when a remote card succeeds.
When using the class name, I get this trace:
Traceback (most recent call last): File "C:\myApps\eclipse\plugins\org.python.pydev.debug_1.5.6.2010033101\pysrc\pydevd.py", line 953, in <module> debugger.run(setup['file'], None, None) File "C:\myApps\eclipse\plugins\org.python.pydev.debug_1.5.6.2010033101\pysrc\pydevd.py", line 780, in run execfile(file, globals, locals) #execute the script File "C:\Documents and Settings\Daniel\workspace\RPM UI - V2\src\MainApp.py", line 2, in <module> from res.elements.MainFrame import RPMWindow File "C:\Documents and Settings\Daniel\workspace\RPM UI - V2\src\res\elements\MainFrame.py", line 2, in <module> from res.elements.MenuBar import MenuBarBuilder File "C:\Documents and Settings\Daniel\workspace\RPM UI - V2\src\res\elements\MenuBar.py", line 2, in <module> from MainApp import _, DataCache File "C:\Documents and Settings\Daniel\workspace\RPM UI - V2\src\MainApp.py", line 2, in <module> from res.elements.MainFrame import RPMWindow ImportError: cannot import name RPMWindow
When using wild card import, I do not get a trace and my application opens.