My python entrypoint needs to be run as a module (not a script), as in:
python -m foo.bar
The following does not work (and is not supposed to):
python foo/bar.py
How can I create a run confirguration in pycharm that runs my code using the first invokation above?
According to man python
, the -m
option
-m module-name
Searches sys.path for the named module and runs the corresponding .py file as a script.
So most of the time you can just right-click on bar.py
in the Project tool window and select Run bar
.
If you really need to use the -m
option, then specify it as an Interpreter option, with the module name as the Script in the Edit Configurations dialog:
