Re: GUI freeze and long blocking operation



On 15 June 2013 01:33, Kip Warner <kip thevertigo com> wrote:
as a last resort. Maybe you have some debugging tips? I'm finding it
hard to debug in Python compared to all the many frontends to GDB for
native code.

I never found the Python debuggers very useful. Event-driven programs
are not a great fit with traditional debuggers, in my opinion, because
execution is so non-linear. You are running tiny scraps of code all
over the place in an order set by an external driver that varies
between runs.

I use an interactive python interpreter to try stuff out, plus a lot
of logging. For example, I did a music player that pulses a set of
lightbulbs in time:

  https://github.com/jcupitt/huebert/blob/master/huebert/controller.py

Every method starts with:

  logging.debug('methodname: parameters')

And I debug by running with logging enabled and dumping the output to a file:

  ./huebert.py --debug &> huebert.log

Then load the log into a text editor and compare the trace to what I
think ought to be happening.

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]