Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging with PyCharm terminal arguments

Tags:

python

pycharm

I have been using PyCharm for a bit so I am not an expert.

How I normally ran my programs was with the terminal like so:

program.py -t input1 -t1 input2

I was wondering how can I debug this?

For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.

like image 999
Liondancer Avatar asked Jan 14 '15 20:01

Liondancer


People also ask

How do you debug Python command line arguments?

Go to your project properties, either by right-clicking on the project and picking "Properties" or by picking Properties from the Project menu. Click on Debug, then enter your arguments into the "Script Arguments" field. Save.

Can you debug from terminal?

To view debug information on the monitor terminal, perform the following tasks: Execute the terminal monitor and terminal debugging commands. Enable the information center (enabled by default). Use a debugging command to enable the related debugging.


1 Answers

Menu: Run -> Edit configurations -> "+" (add new config) -> Python.

Script name: program.py

If you need to debug a script from installed packages, such as tox, you can specify the full path too. For example: Script name: /home/your_user/.envs/env_name/bin/tox

Above /home/your_user/.envs/env_name is a path to virtual environment containing tox package.

Script params: -t input1 -t1 input2

like image 57
Andrew_Lvov Avatar answered Sep 23 '22 12:09

Andrew_Lvov