[CentralOH] IDLE on Mac

Mark Erbaugh mark at microenh.com
Wed May 13 18:56:13 CEST 2009


I recently began working on a Mac. I was able to configure an  
application launcher for IDLE. However, when I open a .py file with  
this launcher, it sets the current working directory to my Documents  
folder. Under Windows and Linux, the working directory would be the  
directory containing the .py file and I would like the Mac to do the  
same.

I found the idlemain.py file inside the IDLE launcher and see where it  
is setting the current working directory, but knowing next to nothing  
about how the Mac actually launches programs, I don't know how to get  
the folder of the .py file. I did look at sys.argv being passed to  
idlemain.py, but it doesn't include the filename of the .py file.

Is it possible to create an IDLE launcher that will set the working  
directory to the folder containing the .py file that I opened?

Thanks,
Mark


More information about the CentralOH mailing list