ImportError: No module named frame

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

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

Hello Gilles,

What do you mean with the "The wxPython Manual" exactly?

if you want to import Frame alone, you have to write:
from wx 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

Yes, that is a little bit confusing.
the Py package has nothing to do with the core package.
These are some applications (Pycrust is a python shell, written
in wxPython itself) and there are some other programs.

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!

That is strange indeed; this I haven't observed until now.

···

On Tue, 13 Sep 2005 00:32:46 -0400, "Gilles Kirouac" <gkirouac@riq.qc.ca> wrote:

Thanks.

Gilles

--
Franz Steinhaeusler

Gilles Kirouac wrote:

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

I'm not sure which "wxPython manual" you got this from, but the "standard" syntax is now:

import wx
class MyFrame(wx.Frame):
     def __init__(self......)
         wx.Frame.__init__(....

so the classes are all available in the wx namespace, with the "wx" removed, so that what in C++ is wxClass is wx.Class in Python.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

...

>I defined (copied from The wxPython Manual) module App1.py, of which the first
>lines are:
>
> import wx
>
> from frame import Frame
>

Hello Gilles,

What do you mean with the "The wxPython Manual" exactly?

  It is file wxPythonManual.html dated 2005-06-04 found
in directory C:\P\wxPython2.6 Docs and Demos\docs
that was installed when I executed
wxPython2.6-win32-docs-demos-2.6.1.0.exe.

  Thanks for your answer, Franz.

Gilles

···

From: Franz Steinhäusler <franz.steinhaeusler@gmx.at>

Hello Gilles,

you're welcome,

thank you for pointing out.

I think, "wxPythonManual.html" is rater outdated,
but nevertheless it has some good backround info.

If you are new to wxPython, I suggest
*looking at the wxPython-wiki.

http://wiki.wxpython.org

http://wiki.wxpython.org/index.cgi/How_20to_20Learn_20wxPython
http://wiki.wxpython.org/index.cgi/Getting_20Started
...

* playing around with PyCrust
* look at the demo and use the new possibility to modify the demo samples
* and of course this mailing list :wink:

···

On Tue, 13 Sep 2005 19:12:50 -0400, "Gilles Kirouac" <gkirouac@riq.qc.ca> wrote:

From: Franz Steinhäusler <franz.steinhaeusler@gmx.at>
...

>I defined (copied from The wxPython Manual) module App1.py, of which the first
>lines are:
>
> import wx
>
> from frame import Frame
>

Hello Gilles,

What do you mean with the "The wxPython Manual" exactly?

It is file wxPythonManual.html dated 2005-06-04 found
in directory C:\P\wxPython2.6 Docs and Demos\docs
that was installed when I executed
wxPython2.6-win32-docs-demos-2.6.1.0.exe.

Thanks for your answer, Franz.

Gilles

--
Franz Steinhaeusler