Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change default directory for IDLE in windows?

The installation directory is "d:\python2.7", and every time I open IDLE and click on menu File and Open item, the default directory is also "d:\python2.7". So I have to change the directory to where I want.

Is there any way I can change it? Using configuration file or changing environment variable?

I tried to add PYTHONPATH in environment variable, but it doesn't work. I also import os, and use os.chdir(), but it only changes the working directory, not what I want.

Thank you.

like image 713
little白 Avatar asked Apr 11 '13 15:04

little白


2 Answers

If you're running IDLE from a Windows shortcut, you can just right-click on the shortcut, choose "Properties", and change the field "Start in" to any directory you like.

like image 116
Aya Avatar answered Nov 10 '22 08:11

Aya


In response to the answer by Aya:

If you're running IDLE from a Windows shortcut, you can just right-click on the shortcut, choose "Properties", and change the field "Start in" to any directory you like.

Yes you can, however Python IDLE will no longer run. I've found that if the Start In directory for the IDLE shortcut is C:\Python33 or C:\Python33\Lib\idlelib (in my case) that it will still work but if I added a new directory below either of these (for example: myfiles) containing my programs then the IDLE editor fails. In my situation, I've spend days now trying to get Python to easily get to my .py programs by clicking FILE+OPEN in the IDLE editor. Also, I've tried everything to get IDLE to run without failing from the Windows Explorer using right click and selecting "edit with IDLE" but although Idle does opens okay trying to RUN a program from there fails. I did manage to get IDLE to work using SEND TO and until I get an answer to my IDLE issue Post that is what I suppose I will have to do. Hope this helps.

like image 1
Lynn Rice 2259129 Avatar answered Nov 10 '22 10:11

Lynn Rice 2259129