[CentralOH] Idle MacPython 2.6.4 / sys.Path

Mark Erbaugh mark at microenh.com
Wed Dec 30 19:10:13 CET 2009


On Dec 30, 2009, at 11:59 AM, m g wrote:

> You could always just set the PYTHONPATH environment variable too.

Thanks for the reply. I think that would only work if I always wanted the same directory in PYTHONPATH.

I did a little more digging, but still don't know enough about the Mac launch process.  Here's what I have found.

If you view the contents of the IDLE Package (Mac Package, not a Python Package), in Contents/MacOS is a python script IDLE.py that apparently participates in the process. It runs the python script idlemain.py which is in the Contents/Resources folder.  I've been able to walk through the process and see where idlemain.py is setting the current working directory (to my Documents folder).  There are some notes in idlemain.py about what it is doing.

What I haven't been able to find is how the .py file(s) that I want to open are passed to idle. They aren't in sys.argv passed to either IDLE.py or idlemain.py. They don't appear to be in environment variables.  I'm thinking that if I can find the .py file that I want to start with, I could modify idlemain.py to set the current working directory to it's folder. Perhaps that's the rub, the files launched can't be found and why the launcher doesn't already do this.

Mark



More information about the CentralOH mailing list