python debugger tips?

Discussion in 'Python' started by just.another.random.user@gmail.com, Oct 10, 2008.

  1. Guest

    Hi All,

    I'm switching to python from perl, and like the language a ton, but I
    find pdb and pydb to be vastly inferior debuggers to the perl version.

    In particular, I've grown very used to stepping into arbitrary
    functions interactively. For instance, in perl you can do this:

    casqa1:~> perl -de 42

    Loading DB routines from perl5db.pl version 1.28
    Editor support available.

    Enter h or `h h' for help, or `man perldebug' for more help.

    main::(-e:1): 42
    DB<1> sub foo {return 42}



    DB<2> s foo()
    main::((eval 7)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:3):
    3: foo();


    DB<<3>> s
    main::foo((eval 6)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:2):
    2: sub foo {return 42};
    DB<<3>>



    Which is quite awesome; I don't have to restart the program if I want
    to step through a given function call with a different set of values.

    Does anyone have advice on any macros or something that i could use to
    do this?

    Additionally, what do people recommend as good "advanced" python
    debugger guides? Explaining breakpoints and all is useful, but I
    really want to know how to make sophisticated macros and interact with
    the debugger from the interactive prompt.

    Thanks!
    Y
     
    , Oct 10, 2008
    #1
    1. Advertising

  2. Stef Mientki Guest

    take a look at winpdb (which has no relation with Windows-OS !!

    cheers,
    Stef
     
    Stef Mientki, Oct 10, 2008
    #2
    1. Advertising

  3. Guest

    On Oct 10, 5:58 pm, Stef Mientki <> wrote:
    > take a look at winpdb (which has no relation with Windows-OS !!
    >
    > cheers,
    > Stef


    Looks pretty cool; sadly, our sysadmin refuses to install wxwindows,
    and the commandline version is fairly cryptic...

    Thanks!
    Y
     
    , Oct 10, 2008
    #3
  4. a écrit :
    > Hi All,
    >
    > I'm switching to python from perl, and like the language a ton, but I
    > find pdb and pydb to be vastly inferior debuggers to the perl version.
    >
    > In particular, I've grown very used to stepping into arbitrary
    > functions interactively. For instance, in perl you can do this:
    >
    > casqa1:~> perl -de 42
    >
    > Loading DB routines from perl5db.pl version 1.28
    > Editor support available.
    >
    > Enter h or `h h' for help, or `man perldebug' for more help.
    >
    > main::(-e:1): 42
    > DB<1> sub foo {return 42}
    >
    >
    >
    > DB<2> s foo()
    > main::((eval 7)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:3):
    > 3: foo();
    >
    >
    > DB<<3>> s
    > main::foo((eval 6)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:2):
    > 2: sub foo {return 42};
    > DB<<3>>
    >
    >
    >
    > Which is quite awesome; I don't have to restart the program if I want
    > to step through a given function call with a different set of values.


    In your python shell:

    import somelib
    import pdb
    pdb.runcall(somelib.somefunc, 42, foo='bar')


    Also and IIRC, ipython (an alternative and more featurefull python
    shell) has some interesting stuff wrt/ pdb integration.
     
    Bruno Desthuilliers, Oct 11, 2008
    #4
  5. IDLE on py3k

    Being a bit of an old fart, I much prefer to do my text editing on a dark
    background. I find the paper-emulation paradigm an interesting idea but
    lacking in ergonomic value.

    With a bit of jiggering I was able to get the 2.5 version of IDLE to work
    the way I want, namely a black background with text in various colours. I
    can ALMOST do the same thing with the IDLE that comes with python 3 except
    that the window background remains steadfastly white. So I see colour on
    black for all the portions of the screen where text appears, but the blank
    areas (end of line to right margin) are white.

    Has anyone else encountered such a problem or am I the only one to even try
    it?
     
    Jonathan Saxton, Oct 13, 2008
    #5
  6. Pat Guest

    wrote:
    > Hi All,
    >
    > I'm switching to python from perl, and like the language a ton, but I
    > find pdb and pydb to be vastly inferior debuggers to the perl version.
    >
    > In particular, I've grown very used to stepping into arbitrary
    > functions interactively. For instance, in perl you can do this:


    >
    > Does anyone have advice on any macros or something that i could use to
    > do this?
    >
    > Additionally, what do people recommend as good "advanced" python
    > debugger guides? Explaining breakpoints and all is useful, but I
    > really want to know how to make sophisticated macros and interact with
    > the debugger from the interactive prompt.
    >
    > Thanks!
    > Y


    I'd strongly recommend you try Wing Pro IDE (Windows or *IX)

    http://wingware.com/

    Free 30 day trial (10 days at a time). You can download and fully use
    the program (it's not crippled) without having to use a credit card.
    $179/user/operating system.

    Absolutely great for debugging code. You can take chunks of code and
    put into the integrated Python shell (a Wing pane) and test it out.

    As I'm writing code, I test out each line then blocks of code. While
    running the program, the integrated Python shell recognizes your
    variables and you can modify them on the fly.

    I found Eclipse to be inscrutable for Python but I was able to
    understand and use Wing within an hour or so. There's a free
    showmedo.com video of the Wing IDE
    (http://showmedo.com/videos/video?name=pythonOzsvaldWingIDEIntro)

    Wing IDE Pro is missing some features that Eclipse has but I thought
    that Wing was so much better than Eclipse that I paid for Wing Pro. The
    license allowed me to put it on my home and work computers. I am in no
    way affiliated with the company except that I'm a very satisfied customer.
     
    Pat, Oct 17, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Skip Montanaro

    Python performance tips page moved to wiki

    Skip Montanaro, Mar 29, 2005, in forum: Python
    Replies:
    0
    Views:
    592
    Skip Montanaro
    Mar 29, 2005
  2. wipit
    Replies:
    2
    Views:
    4,969
    wipit
    Aug 8, 2006
  3. Robert Oschler
    Replies:
    1
    Views:
    241
    Mcginkel
    Sep 5, 2005
  4. aflat362
    Replies:
    7
    Views:
    234
    naixn
    Dec 7, 2006
  5. Replies:
    1
    Views:
    3,427
    Arne Vajhøj
    Jul 31, 2012
Loading...

Share This Page