This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Provide IDLE menu option to set command-line arguments
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.5
Status: closed Resolution: duplicate
Dependencies: Superseder: Simulate command-line arguments for program run in IDLE
View: 5680
Assigned To: Nosy List: Saimadhav.Heblikar, mcepl, rhettinger, terry.reedy
Priority: normal Keywords:

Created on 2015-03-14 23:33 by rhettinger, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg238108 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-03-14 23:33
A number of IDEs support menu options to set the execution environment for programs under development and testing.  In particular, it would be nice if IDLE let the user set command line arguments to be passed into sys.argv when running a script by pressing F5.

Here are some existing implementations for reference:
* Wing-IDE:
* Visual Studio:
* PyCharm:

This feature will help users interactively develop and test command-line tools while retaining all the nice features of the IDE.   I would personally find it useful when teaching students about how sys.argv works.

I suggest adding an option under the Run menu for Set Command Line arguments.  It would trigger a dialog box that lets a user set a string such as "somefile.txt -r 10".  The user string would be run through shlex to break it into separate fields.  When F5 is pressed, the sys.argv list would be repopulated to include the script name and the lexed arguments.

A little more elaborate option is to add a Run menu entry for Set Execution Enviroment that let's the user 1) set the command-line  2) specify the start-up directory (using os.chdir), 3) and edit the environment variables (from os.environ) or at least be able to set PYTHONPATH.
msg238207 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2015-03-16 14:11

Also had submitted a patch for it. Could you post your review there? (I was learning the CPython style then, so excuse obvious mistakes :) )
msg238728 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-03-20 22:03
#5680 has 3 different patches. I have not reviewed them yet.  I will link to Raymond's message there.
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67853
2016-09-09 21:40:57mceplsetnosy: + mcepl
2015-03-20 22:03:37terry.reedysetstatus: open -> closed

superseder: Simulate command-line arguments for program run in IDLE

nosy: + terry.reedy
messages: + msg238728
resolution: duplicate
stage: needs patch -> resolved
2015-03-16 14:11:25Saimadhav.Heblikarsetnosy: + Saimadhav.Heblikar
messages: + msg238207
2015-03-14 23:33:44rhettingercreate