Debugging woes on python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Glenn Reed

    Debugging woes on python

    This is just a general comment after trying my hand at some serious python
    programming for the first time. Have played with it for some time but this
    is the first serious thing I've done with it. (By serious I mean 650 lines
    of python code written for a client).

    The version of Python is the ActiveState version for Windows which included
    PythonWin IDE.

    Prior to that I learn't Perl and used it for sometime. What I miss with
    python is the lack of a straightforward command line debugger. That is
    setting breakpoints and going step, step, step thru my code and examining
    variables as appropriate. While I enjoyed Python's better syntax I found
    Python's debugger frustrating and basically found it unusable. I could set
    breakpoints by using PythonWin but I couldn't step thru the code. The worst
    thing was that I couldn't list the source code or see any visual recognition
    of stepping thru source code. The debugger was Python's pdb module. Is
    there anything better for python? It didn't take me this long to get
    started with Perl's command line (non-GUI) debugger.

    Thanks in advance
    Glenn.


  • Neil Hodgson

    #2
    Re: Debugging woes on python

    Glenn Reed:[color=blue]
    > I could set
    > breakpoints by using PythonWin but I couldn't step thru the code.[/color]

    File | Debug |Step In (F11) works for me in PythonWin build 157. You can
    view variables either using the Interactive Window, or int the Watch or
    Stack Windows.

    Neil


    Comment

    • John Roth

      #3
      Re: Debugging woes on python


      "Glenn Reed" <glenn.r@ihug.c o.nz.nospam> wrote in message
      news:bmdq3l$d8d $1@lust.ihug.co .nz...[color=blue]
      > This is just a general comment after trying my hand at some serious python
      > programming for the first time. Have played with it for some time but[/color]
      this[color=blue]
      > is the first serious thing I've done with it. (By serious I mean 650[/color]
      lines[color=blue]
      > of python code written for a client).
      >
      > The version of Python is the ActiveState version for Windows which[/color]
      included[color=blue]
      > PythonWin IDE.
      >
      > Prior to that I learn't Perl and used it for sometime. What I miss with
      > python is the lack of a straightforward command line debugger. That is
      > setting breakpoints and going step, step, step thru my code and examining
      > variables as appropriate. While I enjoyed Python's better syntax I found
      > Python's debugger frustrating and basically found it unusable. I could[/color]
      set[color=blue]
      > breakpoints by using PythonWin but I couldn't step thru the code. The[/color]
      worst[color=blue]
      > thing was that I couldn't list the source code or see any visual[/color]
      recognition[color=blue]
      > of stepping thru source code. The debugger was Python's pdb module. Is
      > there anything better for python? It didn't take me this long to get
      > started with Perl's command line (non-GUI) debugger.[/color]

      I suspect that part of the reason is simply that a lot of us have gotten
      bitten by the Test Driven Development bug, and found that debuggers
      are simply unnecessary if we have pervasive executable programmer
      tests.

      The other part of the reason is that Python is largely a volunteer effort.
      There's no intrinsic reason why it couldn't grow a command line
      debugger, but it's something that someone is going to have to want
      enough to write, debug and convince the core developers group to
      include in the distribution.

      If you want to start on this effort, I'd suggest looking at the
      debugging interface in IDLE, since it has to deal with cross-process
      issues.

      John Roth

      [color=blue]
      >
      > Thanks in advance
      > Glenn.
      >
      >[/color]


      Comment

      • Anthony Baxter

        #4
        Re: Debugging woes on python

        [color=blue][color=green][color=darkred]
        >>> "Glenn Reed" wrote[/color][/color]
        > Prior to that I learn't Perl and used it for sometime. What I miss with
        > python is the lack of a straightforward command line debugger. That is
        > setting breakpoints and going step, step, step thru my code and examining
        > variables as appropriate. While I enjoyed Python's better syntax I found
        > Python's debugger frustrating and basically found it unusable. I could set
        > breakpoints by using PythonWin but I couldn't step thru the code. The worst
        > thing was that I couldn't list the source code or see any visual recognition
        > of stepping thru source code. The debugger was Python's pdb module. Is
        > there anything better for python? It didn't take me this long to get
        > started with Perl's command line (non-GUI) debugger.[/color]

        "import pdb ; pdb.set_trace() "

        See also the module docs for pdb.

        --
        Anthony Baxter <anthony@interl ink.com.au>
        It's never too late to have a happy childhood.


        Comment

        • Alexander Schmolck

          #5
          Re: Debugging woes on python

          "Glenn Reed" <glenn.r@ihug.c o.nz.nospam> writes:
          [color=blue]
          > This is just a general comment after trying my hand at some serious python
          > programming for the first time. Have played with it for some time but this
          > is the first serious thing I've done with it. (By serious I mean 650 lines
          > of python code written for a client).
          >
          > The version of Python is the ActiveState version for Windows which included
          > PythonWin IDE.
          >
          > Prior to that I learn't Perl and used it for sometime. What I miss with
          > python is the lack of a straightforward command line debugger. That is
          > setting breakpoints and going step, step, step thru my code and examining
          > variables as appropriate. While I enjoyed Python's better syntax I found
          > Python's debugger frustrating and basically found it unusable. I could set
          > breakpoints by using PythonWin but I couldn't step thru the code. The worst
          > thing was that I couldn't list the source code or see any visual recognition
          > of stepping thru source code. The debugger was Python's pdb module. Is
          > there anything better for python? It didn't take me this long to get
          > started with Perl's command line (non-GUI) debugger.[/color]

          I recommend using ipython from with emacs (and typing "@pdb on" -- then any
          exception will automatically land you in the debugger -- VERY VERY handy and
          pretty much my default setting when I do any software or test code
          development). You can also do the same from just within ipython (you loose the
          automatic tracking of corresponding source in emacs). You can also just use
          'plain' python's pdb, which is a bit flakey as a standalone debugger, but
          useable (see the module docs).

          'as

          Comment

          Working...