0

To clarify my question, for example in some IDEs such as PyCharm one can put a breakpoint in the code, run the python script and when the code reaches that breakpoint, the program stops while the user can investigate some of the variables until that breakpoint.

Is such functionality possible through a terminal, that is executing a python code but while having it stopped at a certain line, a python console would be available for debugging.

Alejandro
  • 879
  • 11
  • 27

2 Answers2

1

Yes, you can use builtin Python Debugger import pdb; pdb.set_trace() as a one-liner to get full access to the current scope you are in, ability to call any functions, step through code, display values etc.

There's also https://pypi.org/project/pdbpp/ which needs to be installed separately. It has all the features that pdb has and then some.

EdvardM
  • 2,934
  • 1
  • 21
  • 20
-1

i think that is not possible if u are running it in just the terminal.

if u want to investigate variables and stuff at a certain point, maybe u can simply just code lens

kalimdor18
  • 99
  • 13
  • 1
    How do you think people debugged software before "code lens" existed? Interactive, text-based debuggers have been around since before GUIs existed at all; and it's pretty much unheard of for a language to neither provide its own or support a common one (in the latter case, gdb is the de facto standard). – Charles Duffy Aug 31 '20 at 16:00