Using WindowsXP, I installed wxPython2.6-win32-unicode-2.6.1.0-py24.exe in my
Python24 directory.
I defined (copied from The wxPython Manual) module App1.py, of which the first
lines are:
import wx
from frame import Frame
Then when I execute it, I get:
execfile ("gk\\App1.py")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "gk\App1.py", line 3, in ?
from frame import Frame
ImportError: No module named frame
I tried to analyse the problem, but ...
Under wx-2.6-msw-unicode\wx, __init__.py lists "py" in __all__.
So py is a subpackage. Under py, there is another __init__.py.
In this one, there is no __all__ definition, but rather a bunch
of import statements of which "import frame". And the top doc is
"""The py package, formerly the PyCrust package."""
It appears that the __init__ of Py(Crust) was designed specially for it.
However a solution I found was to explicitly add to the path
the directory of module "frame"
c:\python24\lib\site-packages\wx-2.6-msw-unicode\wx\py
Why? Its __init__.py is unchanged. Does this mean that the first level *.py
files are automatically modules of the package represented by their directory
name?
Also
print sys.path
['', 'C:\\Python24\\python24.zip', 'C:\\Python24', 'C:\\Python24\\DLLs', 'C:\\P
thon24\\lib', 'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk', 'C:\\
ython24\\lib\\site-packages', 'C:\\Python24\\lib\\site-packages\\wx-2.6-msw-uni
ode']
why is C:\\Python24\\python24.zip in the path? It doesn't even exist!
Thanks.
Gilles