Search code examples
pythonpycharm

How to pass "-v" argument for Python in PyCharm IDE


I want to run a Python program in verbose mode in PyCharm IDE. I specified "-v" in Interpreter option under Run/Debug Configurations window. But it shows the following error:

/usr/bin/python2.7
/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py
35261 34268 -v
/home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
Traceback (most recent call last):   File
"/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py",
line 71, in <module>
    globals = run_file(file, None, None)   File "/home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py",
line 31, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script IOError: [Errno 2] No such file or directory: '-v' Running -v

Solution

  • It should work if you run it like this:

    /usr/bin/python2.7 -v /home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
    

    If you need debugger (or to add other files) then -v should go first:

    /usr/bin/python2.7 -v /home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py 35261 34268 /home/user1/my_codings/gitStuffs/Cura_Debian_Release/usr/share/cura/cura.py
    

    In PyCharm you should add -v /home/user1/Downloads/pycharm-community-2016.1.4/helpers/pydev/pydev_run_in_console.py 35261 34268 inside Interpreter options.