Interactive debugging

6

63q2o4i02

Hi, is there a way in python to place some sort of keyboard() type
statement which stops the script and puts you back at the console? I'm
looking for something like in matlab, where you place a keyboard()
command (I think), then you're in debug mode in the console, and you
type continue to re-enter the script where you left off. While you're
in the debugger/console you're at the scope where the keyboard() call
was and you can manipulate variables, etc. Is there something like
this in python? I've been using winpdb, which is great, but sometimes
I need more interactivity. Is this what pdb is about?

thanks
ms
 
D

Diez B. Roggisch

Hi, is there a way in python to place some sort of keyboard() type
statement which stops the script and puts you back at the console? I'm
looking for something like in matlab, where you place a keyboard()
command (I think), then you're in debug mode in the console, and you
type continue to re-enter the script where you left off. While you're
in the debugger/console you're at the scope where the keyboard() call
was and you can manipulate variables, etc. Is there something like
this in python? I've been using winpdb, which is great, but sometimes
I need more interactivity. Is this what pdb is about?

Use

import pdb
pdb.set_trace()

The line where the set_trace() is invoked puts you back in the interpreter.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top