Does anyone know where or how to set the default path/directory on saving python scripts prior to running?
On a Mac it wants to save them in the top level ~/Documents directory
. I would like to specify a real location. Any ideas?
Does anyone know where or how to set the default path/directory on saving python scripts prior to running?
On a Mac it wants to save them in the top level ~/Documents directory
. I would like to specify a real location. Any ideas?
I am using windows 7 and by going to Start-> IDLE(Python 3.6 32-bit)
The click on properties and then in the shortcut tab go to Start in and entering the desired path worked for me kindly note if IDLE is open and running while you do this you'll have to shut it down and restart it for this to work
In Windows 10+, click the Windows Start button, then type idle, and then right-click on the IDLE desktop app and open the file location. This should bring you to the Start Menu shortcuts for Python, and you'll find a shortcut to IDLE there. Right-click on the IDLE shortcut and select properties. Set the "Start in" directory to be where you want default save path to be.
On OS X, if you launch
IDLE.app
(by double-clicking or usingopen(1)
, for example), the default directory is hardwired to~/Documents
. If you want to change the default permanently, you'll need to edit the fileidlemain.py
within the IDLE.app application bundle; depending on which Python(s) you have installed, it will likely be in one of:Edit the line:
On the other hand, if you start IDLE from the command line, for example, with:
IDLE will use that current directory as the default.
For OS X:
Open a new finder window,then head over to applications. Locate your Python application. (For my mac,it's Python 3.5)
Double click on it. Right click on the IDLE icon,show package contents. Then go into the contents folder,then resources.
Now,this is the important part:
(Note: You must be the administrator or have the administrator's password for the below to work)
Right click on the idlemain.py,Get Info.
Scroll all the way down. Make sure under the Sharing & Permissions tab,your "name"(Me) is on it with the privilege as Read & Write. If not click on the lock symbol and unlock it. Then add/edit yourself to have the Read & Write privilege.
Lastly,as per Ned Deily's instructions,edit the line:
os.chdir(os.path.expanduser('~/Documents'))
with your desired path and then save the changes.
Upon restarting the Python IDLE,you should find that your default Save as path to be the path you've indicated.
If you are using linux, you can create simple .sh file as presented below::
Run the file :)
On Windows (Vista at least, which is what I'm looking at here), shortcut icons on the desktop have a "Start in" field where you can set the directory used as the current working directory when the program starts. Changing that works for me. Anything like that on the Mac? (Starting in the desired directory from the command line works, too.)