Dan, you are right that logging may be productive in many cases. But there are other cases when logging just doesn't work. For example I have some library code and I want to learn how it works. Or my code is called by library code and I want to know what is going on here, e.g. who has called me. I don't want to modify library sources and just looking at sources is not sufficient, because of dynamic nature of scripting languages. I need to be able to break, see the callstack and step through code.
Other issue is unstructured nature of log messages. If I dump object structure with repr or str, I get poorly formated soup of members. It is hard to read and sometimes you would like to drill down the structure, which is not possible with dumb log strings. Maybe I'm a little bit biased, I'm coming from Microsoft Visual Studio world, where debuggers were always on very high level. On Wed, Dec 31, 2008 at 7:47 PM, boson <[email protected]> wrote: > > Antonin, on behalf of the community, thanks for your great > contributions! > > For what it's worth (and in the absence of more formalized tools), > I've always found logging to be an effective means of debugging when > used *intelligently*. The "logging" module combined with Python's > "repr" function are quite handy. > > import logging > > logging.info("bout to change obj: %s" % repr(obj)) > # do stuff > logging.info("changed obj: %s" % repr(obj)) > > After you get your trouble spot ironed out, just delete the logging > code (or clean it up into something that might be useful for later, > and change .info to .debug, etc.). > > > On Dec 30, 7:57 am, Antonin Hildebrand <[email protected]> > wrote: >> Hello, >> I'm new to Python, I've started with Python approx 5 months ago >> because of GAE. Promising platform, but when I started, I was unhappy >> with the state of the tools around GAE and Python in general. >> >> For log inspection I've created >> FirePython:http://github.com/darwin/firepython/tree/master >> >> FirePython I use all the time with GAE and it is a life saver for me. >> >> --- >> For debugging I've tried almost all free tools >> * Eclipse+pydev (too bloated and slow to start the IDE), >> * WinPdb (not polished, password protection when attaching debug >> session drives me crazy), >> * Komodo (unable to setup debugger with GAE SDK), >> ... >> * I'm looking forward to Netbeans Python support in next version >> >> Nothing satisfied me, mainly because I wanted to stay with my favorite >> code editor (TextMate) during debug sessions and not starting some >> bloated IDE. >> >> I've ended using old pdb in terminal. Unfortunately I was unable to >> setup code completion at least. I've tried to mess with pdb sources, >> but it felt to me like bunch of crap and without debugger to debug it >> I was quite lost :-) >> >> I was so frustrated, that I've written my own debugger shell on top of >> pdb in terminal window. Nicely integrated with TextMate using script >> called PdbTextMateSupport. >> Here is a screenshot:http://public.hildebrand.cz/termate_and_pdb.png >> >> I'm quite new to OSX. I've taken this as a training. I've learned >> MacRuby + Cocoa and have written this terminal sniffer in Ruby. This >> debugger shell has less than 1000 LOC and does just bare minimum. I've >> created TextMate bundle for keyboard shortcut to step the code. >> >> It has some rough edges, but I'm quite happy with this solution. It >> works for me, but it is not public ready. Basicaly it is just a >> weekend hack. I have no extra energy to make this into proper open- >> source project with decent support. >> >> If you are interested in sources >> ...http://github.com/darwin/termite.pdb/tree/master >> >> Fork it or leave it :-) >> >> Best wishes for 2009 and hope for better tools for Python and GAE. >> Antonin >> >> On Dec 29, 12:04 am, Chen Harel <[email protected]> wrote: >> >> > Does anyone here have a simple way to breakpoint your code? >> > I saw a tutorial for PyDev in Eclipse, but what about simpler IDE such >> > as ActivePython? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
