Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

CP123

macrumors regular
Original poster
Dec 22, 2008
182
0
Hello all, I just bought a book on Python, and started to go through it (bought it for my children and myself). I'm having a problem importing 'easygui'.

I downloaded easygui to the following:/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/

When I go in Finder, I see a easygui83 file, that has the easygui in it.

When I type: import easygui in IDLE I get the following messages:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import easygui
ImportError: No module named easygui

What am I doing wrong? Is the easygui file in the wrong place?
 
I've never used easygui, but you may have to use an installer, not just drop it into a directory. Is there a file called setup.py in the module's directory? If so, try running 'python setup.py install'.
 
I've never used easygui, but you may have to use an installer, not just drop it into a directory. Is there a file called setup.py in the module's directory? If so, try running 'python setup.py install'.

There is no file called 'setup.py'

When I try to import easygui from SPE, I get the message that the module is not found.
 
You said that the file name is easygui83? This means that the module you want to import the class from has that name. In order for the python console to see the class "easygui" you must import the module "easygui83". Or to get to the point more quickly you can type: "from easygui83 import easygui"

Or typing: "import easygui83" then "import easygui" should also work.

If neither of these methods work then it could be that the site packages directory is not in the sys.path collection. Let us know if what I said fixes your problem though.
 
You said that the file name is easygui83? This means that the module you want to import the class from has that name. In order for the python console to see the class "easygui" you must import the module "easygui83". Or to get to the point more quickly you can type: "from easygui83 import easygui"

Or typing: "import easygui83" then "import easygui" should also work.

If neither of these methods work then it could be that the site packages directory is not in the sys.path collection. Let us know if what I said fixes your problem though.

I'm getting: Import error. No module named easygui83.

easygui83 is a folder in site packages. easygui.py is located in easygui83. I keep getting module not found.
 
I figured it out. easygui.py has to be in the site-packages folder. Once you download easygui, it creates a folder called easygui83, which has easygui.py in it. You have to take easygui.py out of that folder and put it directly in site-packages.

Now it works.

Thank you everyone for your responses.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.