469,926 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Error Message "ImportError: No module named *****"

Although I have been using Macs for a quarter of a century and was doing scientific programming in the '60's I am VERY new to Python on the Mac. I have been writing some very simple applications and running them using IDLE.

To start with the applications worked OK. However, as time has progressed, the error message "ImportError: No module named ****" has been generated with increasing frequency.

It has now become impossible to use Python effectively. For example, I create a small file called MiniLibrary.py and save it to the desktop. I type at the >>> prompt, in the terminal window import MiniLibrary.

At one time this would have generated a new file MiniLibrary.pyc on the desktop and returned a new prompt >>>. No longer. Now the error message "ImportError: No module named MiniLibrary".

Further information: I am running Python 2.5.1. The computer is a Dual G5 Power PC running OSX 10.4.10. Can anyone help? I am at my wits end and quietly contemplating giving up all attempts at scientific programming on a Mac.
Nov 2 '07 #1
1 3939
6,596 Expert 4TB
Good morning, Prof.

What you need to understand is that there are certain places that Python looks for modules to import: the entire disk is not searched. The key to your problem is having the interpreter start up in the "current working directory" - the directory where you are working on your script.

I'm not a Mac guy, but it sounds like you, at one time, where able to make your "desktop" look like the current working directory when Python was started.

The trick is to let IDLE handle all of this stuff in the beginning.
  1. Edit and save files - someplace better than the desktop
  2. Use the Run menu:Run module command to run your script
  3. Leave importing at the >>> prompt for much later

Hope that helps.
Nov 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Sebastian Stelzer | last post: by
12 posts views Thread by Georg Brandl | last post: by
reply views Thread by Terry Tang | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.