[wxpython-users] ImportError: No module named wx

2,904 views
Skip to first unread message

Stephan Lindner

unread,
May 16, 2009, 10:27:17 PM5/16/09
to wxpytho...@lists.wxwidgets.org
Dear all,


First, sorry, this is probably a trivial question, but I have no
experience in python (I know it is a great program, just have to spend
my time learning some other programs), and I tried some solutions
posted on the web without success.


I have installed wxPython 2.8.9.2 in order to run a program called
wammu ( it is supposed to be able to connect my cellphone to the
computer). The I try to run wammu, it gives me the following error:


Traceback (most recent call last):
File "/usr/bin/wammu", line 31, in <module>
import Wammu.Locales
File "/usr/lib/python2.5/site-packages/Wammu/Locales.py", line 31, in <module>
import wx
ImportError: No module named wx


I asked the person who wrote wammu, and he said it is a problem with
wxPython.

I figured the error comes from wxpython being unabled to find the
module wx, so after some searching, I added a couple of paths to my
sys path in python:


['',
'/usr/lib/python25.zip',
'/usr/lib/python2.5',
'/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk',
'/usr/lib/python2.5/lib-dynload',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/gtk-2.0',
'/home/steve/pkglocal/wxPython-src-2.8.9.2/lib',
'/home/steve/pkglocal/wxPython-src-2.8.9.2/wxPython/wx'
]


The last two are the directories called wx in the wxPython path on my
$home directory. Still then, I try to run wammu, the same error
returns.

Similarly, in python


>>> import Wammu.Locales
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/Wammu/Locales.py", line 31, in <module>
import wx
ImportError: No module named wx


I know I get something obvious wrong, but I can't point my finger on
what it is. Any takers?


I'm running a slware 12.2 box.

Thanks so much,


Stephan


--
-----------------------
Stephan Lindner
University of Michigan

Christoph Willing

unread,
May 17, 2009, 1:05:55 AM5/17/09
to wxpytho...@lists.wxwidgets.org

On 17/05/2009, at 12:27 PM, Stephan Lindner wrote:

> Dear all,
>
>
> First, sorry, this is probably a trivial question, but I have no
> experience in python (I know it is a great program, just have to spend
> my time learning some other programs), and I tried some solutions
> posted on the web without success.
>
>
> I have installed wxPython 2.8.9.2 in order to run a program called
> wammu ( it is supposed to be able to connect my cellphone to the
> computer). The I try to run wammu, it gives me the following error:


Stephan,

Maybe it is something about your wxPython installation. I used the
built wxPython package from:
http://www.vislab.uq.edu.au/slackware/12.2/wxPythonGTK-2.8.9.2-i686-2.tgz

and built wammu (and its prerequisite python-gammu) just now and it
works fine. Well, the interface runs fine but I have no phone to
attach and test that part of it.


chris

> _______________________________________________
> wxpython-users mailing list
> wxpytho...@lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Stephan Lindner

unread,
May 17, 2009, 12:24:06 PM5/17/09
to Christoph Willing, wxpytho...@lists.wxwidgets.org

Hi Chris,


Thanks for the post, it was helpful, while I still run into some
problem. I reinstalled wxPython using your link -- thanks a lot, I
should have checked that before! --, and then calling wammu now, it
moves passed the initial problem, but still aborts with an error
message:

bash-3.1$ wammu


Traceback (most recent call last):

File "/usr/bin/wammu", line 170, in <module>
import Wammu.App
File "/usr/lib/python2.5/site-packages/Wammu/App.py", line 28, in <module>
import Wammu.Main
File "/usr/lib/python2.5/site-packages/Wammu/Main.py", line 58, in <module>
import Wammu.Editor
File "/usr/lib/python2.5/site-packages/Wammu/Editor.py", line 36, in <module>
import Wammu.Data
File "/usr/lib/python2.5/site-packages/Wammu/Data.py", line 28, in <module>
from gammu.Data import Connections, MemoryValueTypes, CalendarTypes, CalendarValueTypes, TodoPriorities, TodoValueTypes, InternationalPrefixes
ImportError: No module named gammu.Data

I suspect that this might be b/c of the directories I'm installing
gammu. Would you mind telling me where you installed gammu and wammu?
Also, could you post your call massage when you type wammu on the
console, that would help a lot!


Thanks again,


Stephan

raffaello

unread,
May 16, 2009, 11:58:04 PM5/16/09
to wxpytho...@lists.wxwidgets.org
I don't know this program called wanmu, but the first line in any program using wxPython must be:
import  wx

Cheers

2009/5/17 Stephan Lindner <lind...@umich.edu>:

C M

unread,
May 17, 2009, 12:57:27 AM5/17/09
to wxpytho...@lists.wxwidgets.org

What happens if at the Python prompt you just write

>> import wx

Can it import it?

Christoph Willing

unread,
May 17, 2009, 4:08:32 PM5/17/09
to Stephan Lindner, wxpytho...@lists.wxwidgets.org


Stephan,

I had this same error the first time I tried. It was because gammu
didn't have python support built in. Do you have a /usr/lib/python2.5/
site-packages/gammu/ directory with Data.py in it? If not, make sure
you're using the latest version of gammu (1.24.0); the build process
should detect your python installation and include support for it. If
not, you could try building gammu with -DENABLE_PYTHON=YES option to
cmake.


> I suspect that this might be b/c of the directories I'm installing
> gammu. Would you mind telling me where you installed gammu and wammu?

The python component of gammu is in /usr/lib/python2.5/site-packages/
gammu and wammu is in /usr/lib/python2.5/site-packages/Wammu (and /usr/
bin/wammu).


> Also, could you post your call massage when you type wammu on the
> console, that would help a lot!

Not much to see - here's a start up and then an exit from the Wammu-
>Exit menu:
2) d5:~ % wammu
Debug log created in temporary file </tmp/wammu5YOC04.log>. In case of
crash please include it in bugreport!
Looks like normal program termination, deleting log file.
3) d5:~ %


chris

Robin Dunn

unread,
May 18, 2009, 10:17:14 PM5/18/09
to wxpytho...@lists.wxwidgets.org

I see you've solved this but for the record the last two directories are
the wxPython source tree. If you haven't built (and preferably
installed) wxWidgets and wxPython then doing this will not help you.
wxPython is not just Python source but also lots of C++ that needs to be
compiled.


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

Reply all
Reply to author
Forward
0 new messages