PyCharm "Run configuration" asking for "script parameters"

Currently the only possibility is to use the "Before launch | Show this page" option.


Although yole's answer is the de facto way to be prompted for thw arguments before running a program, it is slightly annoying because:

  • the dialog is visually overwhelming and cluttered instead of focused on what you want to do;
  • you have to tab to reach the arguments field if you want to use the keyboard exclusively (and why not?);

Nothing you could do about that. (Except maybe file a ticket. Have you done that?)


I'm just adding what I used to do before I knew about Googled for this option for the sake of completeness (obvously, this is a hack in the least glamorous sense of the term). But it did suit my workflow as I often only had discrete lines to test with, and didn't switch that often.

  1. Create a new configuration set to the same file, but with a special 'magic' parameter;
  2. Add code to your script to check if the magic is there;
  3. Use a string variable instead of sys.argv (pass it through lambda args: [__name__] + args.split() to reduce the boilerplate);
  4. ???
  5. Profit;

I've found today that now is possible to ask for parameters using the "Prompt" macro on the "Run configuration" parameters field.

https://www.jetbrains.com/help/pycharm/code-running-assistance-tutorial.html#parameter-with-macros