#11 AttributeError: 'module' object has no attribute 'msgbox'

v 0.96
fixed
5
2015-02-05
2012-08-01
Csanyi Pal
No

Hi,

I have installed on my Debian GNU/Linux testing/sid
python3-easygui
python3.2

I'm trying to follow tutorial from here:
http://easygui.sourceforge.net/tutorial/index.html#contents_item_2

When I'm trying to run the easygui.py with
python easygui.py

in an xterm window I get the following error:

Traceback (most recent call last):
File "easygui.py", line 1, in <module>
import easygui as eg
File "/debian-adatok-1/Programozas/Python/Emacsszal/easygui.py", line 5, in <module>
eg.msgbox("Hello, world!")
AttributeError: 'module' object has no attribute 'msgbox'

How can I solve this problem?

Regards from Pál

Discussion

  • Stephen Ferg

    Stephen Ferg - 2012-08-01
    • status: open --> open-fixed
     
  • Stephen Ferg

    Stephen Ferg - 2012-08-01

    It looks like you saved the tutorial code from
    http://easygui.sourceforge.net/tutorial/index.html#contents_item_2
    into a file named easygui.py.

    So when your script tries to import easygui, it ends up trying (unsuccessfully of course) to import itself.

    The solution is to rename your file -- I suggest renaming it to something like test1.py -- and then executing it this way.

    >> python test1.py

    -- Steve Ferg

     
  • Csanyi Pal

    Csanyi Pal - 2012-08-02

    I solved this problem by installing into my system the 'python-easygui' debian package from the debian repository.
    However on my system I have installed:
    python2.6
    python2.7
    python3
    python3-easygui
    python-easygui

    etc.

    When I run 'python' command in an xterm windov the I actually use:
    ls -l /usr/bin/python
    lrwxrwxrwx 1 root root 9 júl 27 00:28 /usr/bin/python -> python2.7

    python2.7 and not python3.

    So by installing the python-easygui package I satisfy the dependency for python2.7.

    Regards from Pál

     
  • Robert Lugg

    Robert Lugg - 2014-11-18
    • Group: Python 3.x --> v 0.96
     
  • Robert Lugg

    Robert Lugg - 2015-02-05
    • status: open-fixed --> fixed
     

Log in to post a comment.