You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/terryjreedy'closed_at=Nonecreated_at=<Date2016-11-22.17:54:11.977>labels= ['3.8', 'expert-IDLE', 'type-feature', '3.7']
title='Option to set startup directory in IDLE'updated_at=<Date2020-03-13.00:37:26.033>user='https://github.com/rhettinger'
In my Python courses, Windows users frequently ask about how to set a startup directory so they can run from their Desktop or a custom directory.
The usual answer is to create a short-cut and then alter the properties on that shortcut. However, other programs they are used to will allow the startup directory to be specified from within the program (in our case, the preferences menu).
Also, we should change the default directory from C:\\Python27 which is almost never the right place. A documents directory would be more appropriate.
I agree. I have had in mind (but cannot find an issue) to change the default to a user's home directory, as the best general default. But even that is not really the proper place that many would want. I can adapt and reuse the code used to browse and validate custom help files.
Terry, if you're open to it, I would like to have one of our new aspiring core developers work on this patch under your direction. Nofar Schnider has expressed an interest.
Raymond: yes, I am definitely open to collaboration on this issue. The timing is good as I just started, a month ago, expanding configure dialog testing beyond the trivial one of creating an instance without raising. Real tests are needed preparation for making other changes, including adding other new options in 3.6+. I would like to include this one in 3.6.1, 4 to 6 months from now.
Doing so may require more information about IDLE on *nix and Mac than I currently have. Which of those have you run IDLE on? Or helped people with in your classes?
Nofar: welcome. I have two immediate questions. 1) Which OS do you primarily work with? (I am using Win 10.) Can you test on anything else? 2) Are you only interested in this issue, or might you be open to working on other issues if this one is successful?
Idlelib is not an easy codebase to get into. The +-60 modules are listed in README.txt. There is also a mapping from menu items to implementation code. However, the README does not cover the addition of a new option. I will write and upload a design document or roadmap for this one.
Thanks Terry.
I am working on my Macbook Pro so my OS is macOS Sierra. Would love to test on it and also, I am able to test on several VMs with different Unix distributions.
I am interested in anything that: 1) can help the Python community. 2) I could learn from. So the answer is YES.
The rule for whether to switch to the configured directory might be
if sys.stdout is None: chdir...
On windows, this is true when starting in the console with
pyw(pythonw) -m idlelib
But there is no need to include the (Windows-only) 'w'. It is meant to be used in the Windows icon shortcut. The option to start in the configured directory even from the console might be seen as a plus.
The startup directory problem is especially irritating because by default IDLE starts up in a hidden path. So any locally created .py files can't easily be found using Windows Explorer. If the users do save new .py files to a new folder on their Desktop, then then can't easily import the files they just made. This makes it difficult when teaching how to import their own modules. This issue can be solved letting IDLE's config specify a startup directory much like MS Word does.
Currently on Windows, the IDLE startup directory is now the directory of the python binary that is running IDLE. This may or may not be 'hidden', depending on the install location. But it is still not useful for most people. On macOS, it is now the user's Documents directory. Regardless, the startup directory affects the initial directory for Open and for pure Shell sessions that did not start running code from the editor. (When restarting from an edited file, the initial directory is the file's directory, and that must not change.)
I checked a folder on my desktop with Windows Explorer. When it said [__] > This PC / Desktop / Games, clicking on the blue [__] box turn the entry to C:\Users\Terry\Desktop\Games, with the address selected for copying, which is the text a user would need to enter (or paste) into an IDLE dialog entry box. The right click context menu also had copy entries.
Activity
rhettinger commentedon Nov 22, 2016
In my Python courses, Windows users frequently ask about how to set a startup directory so they can run from their Desktop or a custom directory.
The usual answer is to create a short-cut and then alter the properties on that shortcut. However, other programs they are used to will allow the startup directory to be specified from within the program (in our case, the preferences menu).
Also, we should change the default directory from C:\\Python27 which is almost never the right place. A documents directory would be more appropriate.
terryjreedy commentedon Nov 23, 2016
I agree. I have had in mind (but cannot find an issue) to change the default to a user's home directory, as the best general default. But even that is not really the proper place that many would want. I can adapt and reuse the code used to browse and validate custom help files.
rhettinger commentedon Nov 24, 2016
Terry, if you're open to it, I would like to have one of our new aspiring core developers work on this patch under your direction. Nofar Schnider has expressed an interest.
terryjreedy commentedon Nov 27, 2016
Raymond: yes, I am definitely open to collaboration on this issue. The timing is good as I just started, a month ago, expanding configure dialog testing beyond the trivial one of creating an instance without raising. Real tests are needed preparation for making other changes, including adding other new options in 3.6+. I would like to include this one in 3.6.1, 4 to 6 months from now.
Doing so may require more information about IDLE on *nix and Mac than I currently have. Which of those have you run IDLE on? Or helped people with in your classes?
Nofar: welcome. I have two immediate questions. 1) Which OS do you primarily work with? (I am using Win 10.) Can you test on anything else? 2) Are you only interested in this issue, or might you be open to working on other issues if this one is successful?
Idlelib is not an easy codebase to get into. The +-60 modules are listed in README.txt. There is also a mapping from menu items to implementation code. However, the README does not cover the addition of a new option. I will write and upload a design document or roadmap for this one.
Shredder13 commentedon Nov 27, 2016
Thanks Terry.
I am working on my Macbook Pro so my OS is macOS Sierra. Would love to test on it and also, I am able to test on several VMs with different Unix distributions.
I am interested in anything that: 1) can help the Python community. 2) I could learn from. So the answer is YES.
Just let me know where to start!
terryjreedy commentedon Nov 15, 2018
This is partially a duplicate of bpo-22121, but that focused most on the default startup directory on Windows.
tonybaloney commentedon May 6, 2019
Hi Nofar are you still interested on working on this request?
terryjreedy commentedon Mar 13, 2020
The rule for whether to switch to the configured directory might be
if sys.stdout is None: chdir...
On windows, this is true when starting in the console with
pyw(pythonw) -m idlelib
But there is no need to include the (Windows-only) 'w'. It is meant to be used in the Windows icon shortcut. The option to start in the configured directory even from the console might be seen as a plus.
terryjreedy commentedon Jul 16, 2023
In half-duplicate issue #106786, Raymond wrote
Currently on Windows, the IDLE startup directory is now the directory of the python binary that is running IDLE. This may or may not be 'hidden', depending on the install location. But it is still not useful for most people. On macOS, it is now the user's Documents directory. Regardless, the startup directory affects the initial directory for Open and for pure Shell sessions that did not start running code from the editor. (When restarting from an edited file, the initial directory is the file's directory, and that must not change.)
I checked a folder on my desktop with Windows Explorer. When it said
[__] > This PC / Desktop / Games, clicking on the blue[__]box turn the entry toC:\Users\Terry\Desktop\Games, with the address selected for copying, which is the text a user would need to enter (or paste) into an IDLE dialog entry box. The right click context menu also had copy entries.