[Pythonmac-SIG] More newbie questions

Calvin calvin at xmission.com
Sun Aug 29 02:21:56 CEST 2004

> This next one is a bit more of an issue, though. How can I get 
> imports to work from the command line in IDLE or PythonIDE? I can't 
> seem to figure out any way to set the current working directory. 
> Trying to put the full path on the command line simply results in an 
> error. This might be simple, but it is stumping me and the limited 
> documentation doesn't seem to help. Do I have to set the sys.path to 
> include my scripts directory (/Users/rodneys/Documents/python)? If 
> so, how do I go about this?

My cheap-o answer to this problem is either to use terminal and start 
python from the directory where your objects are (my prefered method) or 

import os
and os.chdir('your path')

then you can import the objects in that directory.  Of course, I did this 
from terminal so your mileage may vary.


More information about the Pythonmac-SIG mailing list