2

we are running some python scripts on linux

since python are sometimes difficult to understand in case of failure then need to find a good way of debugging

for example from bash world its bash -x

what is the equivalent way for python ?

example without python debug

 python /lpp/airflow/.sec/security.py get_connection_string rmq
Traceback (most recent call last):
  File "/lpp/airflow/.sec/security.py", line 105, in <module>
    get_connection_string(sys.argv[2])
  File "/lpp/airflow/.sec/security.py", line 58, in get_connection_string
    pass_hash  = open(rmq_pass_file, 'r')
IOError: [Errno 2] No such file or directory: '/lpp/airflow/.sec/rmq_pass'
jessica
  • 2,426
  • 24
  • 66
  • do you want a way to run your script from the command line and stop on exceptions? or run line by line from the start? – JL Peyret May 27 '20 at 23:49
  • Do you want a way to run your script from the command line and stop on exceptions - YES – jessica May 28 '20 at 04:09

1 Answers1

0

I usually debug code python by VSCode. And if having some code are too difficult, I can run this line throught terminal. This is my way to see what happends in my program.

AJackTi
  • 63
  • 2
  • 7