AttributeError: 'module' object has no attribute 'App'

2,562 views
Skip to first unread message

Piotr

unread,
Apr 14, 2010, 2:08:10 PM4/14/10
to wxPython-users
Hi All,

A newbie question ... I got the 2.8 source to build with unicode
enabled in debug mode. However, upon attempting to run demo.py I get:
Traceback (most recent call last):
File "demo.py", line 3, in <module>
import Main
File "/home/pstanczyk/Downloads/wxPython-src-2.8.10.1/wxPython/demo/
Main.py", line 355, in <module>
class MyLog(wx.PyLog):
AttributeError: 'module' object has no attribute 'PyLog'

Furthermore, trying the hello world example from the wiki I get:
import wx
>>> app = wx.App(False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'App'

Clearly, I am missing something - any tips warmly welcome

Many thanks in advance

Piotr


python2.5
Python 2.5.1 (r251:54863, Oct 10 2008, 11:26:39)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> dir(wx)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']

Robin Dunn

unread,
Apr 14, 2010, 4:52:36 PM4/14/10
to wxpytho...@googlegroups.com
On 4/14/10 11:08 AM, Piotr wrote:
> Hi All,
>
> A newbie question ... I got the 2.8 source to build with unicode
> enabled in debug mode. However, upon attempting to run demo.py I get:
> Traceback (most recent call last):
> File "demo.py", line 3, in<module>
> import Main
> File "/home/pstanczyk/Downloads/wxPython-src-2.8.10.1/wxPython/demo/
> Main.py", line 355, in<module>
> class MyLog(wx.PyLog):
> AttributeError: 'module' object has no attribute 'PyLog'
>
> Furthermore, trying the hello world example from the wiki I get:
> import wx
>>>> app = wx.App(False)
> Traceback (most recent call last):
> File "<stdin>", line 1, in<module>
> AttributeError: 'module' object has no attribute 'App'
>
> Clearly, I am missing something - any tips warmly welcome
>

Check where the wx module is coming from and verify that it is the one
you just built:

>>> import wx
>>> print wx.__file__

--
Robin Dunn
Software Craftsman
http://wxPython.org

Piotr Stanczyk

unread,
Apr 14, 2010, 6:21:58 PM4/14/10
to wxpytho...@googlegroups.com
Thanks, this is what I get

> cd wxPython-src-2.8.10.1/wxPython
> python2.5
> import wx
>>> print wx.__file__
wx/__init__.pyc

this is the right location, but is it what I should be seeing?


Piotr






--
To unsubscribe, send email to wxPython-user...@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Robin Dunn

unread,
Apr 16, 2010, 12:44:34 AM4/16/10
to wxpytho...@googlegroups.com
On 4/14/10 3:21 PM, Piotr Stanczyk wrote:
> Thanks, this is what I get
>
> > cd wxPython-src-2.8.10.1/wxPython
> > python2.5
> > import wx
> >>> print wx.__file__
> wx/__init__.pyc
>
> this is the right location, but is it what I should be seeing?

That path is okay, but there should be a whole heck of a lot more in the
dir(wx)... Take a look in the wx folder and see what it is doing. The
__init__.py file should be importing everything from the core modules so
it's all in the wx namespace.

Piotr Stanczyk

unread,
Apr 20, 2010, 12:26:17 PM4/20/10
to wxpytho...@googlegroups.com
I thought that there should be more in there ... in the wx folder the
__init__.py file is there but is empty.

Any thoughts?

Piotr

Robin Dunn

unread,
Apr 20, 2010, 3:33:59 PM4/20/10
to wxpytho...@googlegroups.com
On 4/20/10 9:26 AM, Piotr Stanczyk wrote:
> I thought that there should be more in there ... in the wx folder the
> __init__.py file is there but is empty.
>
> Any thoughts?

Start from a clean source tree and try redoing the build, redirecting
the build output to a file. If you end up with the problem again then
examin this file for anything having to do with the installation steps
and what it is doing with that folder.

Mike Driscoll

unread,
Apr 20, 2010, 1:53:07 PM4/20/10
to wxPython-users


On Apr 20, 11:26 am, Piotr Stanczyk <piotr.stanc...@gmail.com> wrote:
> I thought that there should be more in there ... in the wx folder the
> __init__.py file is there but is empty.
>
> Any thoughts?
>
> Piotr
>
>


Reinstall wx?

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Douglas Duhaime

unread,
Jan 30, 2018, 6:13:27 PM1/30/18
to wxPython-users
For what it's worth, I had this same error when using my system-wide Python installation, but resolved this error by using python.app (installed via Anaconda). Here are all the steps I took to fix this problem:

Reply all
Reply to author
Forward
0 new messages