Interactive debugging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 63q2o4i02@sneakemail.com

    #1

    Interactive debugging

    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

  • Fredrik Lundh

    #2
    Re: Interactive debugging

    63q2o4i02@sneak email.com wrote:
    [color=blue]
    > 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?[/color]

    see the third example on this page:



    </F>

    Comment

    • Diez B. Roggisch

      #3
      Re: Interactive debugging

      63q2o4i02@sneak email.com wrote:
      [color=blue]
      > 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?[/color]

      Use

      import pdb
      pdb.set_trace()

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

      Diez

      Comment

      Working...