[CentralOH] Idle MacPython 2.6.4 / sys.Path
mark at microenh.com
Wed Dec 30 17:56:09 CET 2009
On Dec 30, 2009, at 9:40 AM, m g wrote:
> import sys
> import os
> sys.path.insert(0, os.getcwd())
> Having that at the top of the python script would work but is probably
> less than ideal.
Thanks for the reply.
Actually, another problem is the the current working directory is not set to the desired directory either.
I found another thing. If I open a terminal window in the desired folder (I use a ShellHere utility I found somewhere) and launch Idle from the command line, the current directory is added to sys.path, but the current working directory is still not set to the current folder.
I guess I'm kind of spoiled by Windows and Linux because that's what happens there: the directory containing the .py file is set to the current directory and that directory is added to sys.path. It''s very convenient for working with ad-hoc scripts.
More information about the CentralOH