I am trying to debug a script which takes command line arguments as an input. Arguments are text files in the same directory. Script gets file names from sys.argv list. My problem is I cannot launch the script with arguments in pycharm.
I have tried to enter arguments into "Script parameters" field in "Run" > "Edit configuration" menu like so:
In PyCharm the parameters are added in the
Script Parameters as you did but, they are enclosed in double quotes
"" and without specifying the Interpreter flags like
-s. Those flags are specified in the
Interpreter options box.
Script Parameters box contents:
Then, with a simple test file to evaluate:
if __name__ == "__main__": import sys print(sys.argv)
We get the parameters we provided (with
sys.argv holding the script name of course):
['/Path/to/current/folder/test.py', 'file1.txt', 'file2.txt']