[Tutor] Very basic Python question

Luke Paireepinart rabidpoobear at gmail.com
Sat Jun 27 07:16:43 CEST 2009


Daniel Sato wrote:
> Hi,
>
> Let me preface this by saying that I purchased O'Reilly's "Learn 
> Python" yesterday and have no programming experience (I am a 
> photographer by trade) except for a semester of what I think was BASIC 
> on some old apple back in elementary school (circa 1992).
>
> I am not sure what details are relevant, so I will try and include as 
> much as possible.  I have a MacBook Pro running Mac OSX 10.5.6.  I 
> recently dl'ed MacPython 2.5, which installed Python 2.5.4 on my system. 
>
> When I am in the terminal, I can run a module by typing python 
> fullpath/to/script.py
>
> However, when I enter Python from the terminal, by typing python, I 
> can no longer import items in this way unless the .py file is in my 
> user folder /Users/Me.  How can I change my settings so that I can 
> import .py files from a separate directory such as 
> /Users/Me/Documents/PyMods?

Hi Daniel,
You should try uninstalling MacPython.  Macintosh computers come with 
Python preinstalled and you should try to use that version instead.  
Probably what happened was that, when installing the other version of 
Python, you messed up some of the references for the paths of libraries 
and such.

If that doesn't work, look for an article on upgrading Python on a mac, 
it should detail how to fix anything that breaks when you install MacPython.
Good luck, and let us know if you have any other problems!



More information about the Tutor mailing list