3

Create a PyCharm configuration that runs a module a la "python -m foo" shows how to create a PyCharm configuration to run a module by clicking on the module. But how does one create a configuration to run a module by clicking on a file to be processed by that module?

The Grako compiler is run from the command line as:

$ python -m grako foo.ebnf -o foo.py

The grammar file foo.ebnf is in my working directory, and when I click on the grammar file, I want python to run the grako module to compile it into foo.py. Creating a special purpose run configuration that works only on foo is easy enough:

PycharmRunConfig

but how does one create a configuration that when you right click on any file it will show a context menu item to run the module on that file? Normally that is done with something like a %s parameter to specify the filename, but how do you configure PyCharm to display a context menu Run and recognize a filename substitution that works for whatever file the user has selected?

Community
  • 1
  • 1
Dave
  • 3,834
  • 2
  • 29
  • 44

0 Answers0