On Tue, Feb 22, 2011 at 6:55 PM, Ivanov Dmitriy <[email protected]> wrote: > Don't know, why, but sometimes the plugin drops leo on the line: > > node.b = json.dumps(files) > > I repeated the same sequence and it worked well. > > Can somebody tell me, how to effectively program leo plugins, so I > won't need to restart leo after I modify the code, so it would load > the new plugin again?
I test Leo in a separate copy so that I don't have to reload Leo. See the FAQ: http://webpages.charter.net/edreamleo/FAQ.html#how-can-i-use-leo-to-develop-leo-itself > And how to debug? I use two main methods: 1. Insert calls to g.trace to see what is happening. This is extremely easy to do with Python. For complex code, I use variations on the following pattern:: trace = False and not g.unitTesting # change False to True to enable verbose = False # Optional, for complex traces. if trace: g.trace(<<list of variables to trace, just like print>>) if trace and verbose: g.trace(<< more complex traces>>) Leo's source code has many examples of this pattern. 2. Use g.pdb() a wrapper for:: import pdb ; pdb.set_trace() pdb is your friend for mysterious bugs. They don't happen often with Python. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" 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/leo-editor?hl=en.
