[Grok-dev] Re: Suggestions or advice for how to debug a grok
app using PyDev?
cstrong at arielpartners.com
Sun Jun 8 20:25:26 EDT 2008
We finally got a chance to try this out, and I am now happily debugging
my Grok/Zope3 application woo-hoo!
Martin Aspeli wrote:
> Craeg Strong wrote:
>> After unsuccessfully trying both Eric4 and SPE, I finally settled on
>> Eclipse + PyDev as a debugging environment/IDE for Grok.
> I am using PyDev with Eclipse on Windows, and ended up using
> collective.recipe.omelette to wire up a faux pythonpath with all
> dependencies. I then set this as a source folder in pydev. I also set
> the Zope 2 lib/python directory as one (you probably don't need
> anything like this), and my custom source folders. This gives me full
> code completion and proper inspection.
> I'd use the debug server. You need to add the pydevd sources to your
> PYTHONPATH (I start Zope from within Eclipse, and have it as a source
> folder) and then you do:
> import pydevd; pydevd.set_trace()
> You'll need to start the debug server in Eclipse (go to the debug
> perspective, there's a toolbar button) and then restart Zope. Once
> that line is hit, you should get to the debugger.
I didn't yet use omlette, so the debugger says "source not available"
for certain Grok and Zope3 egg python modules, but for now I am happy
just to be able to debug my own code.
My steps were:
1) edit sys.path in MyApp/parts/app/runzope to include pydevd
CKS 8 June 2008 make it possible to debug
an External Source Folder in my eclipse PyDev project properties
3) start the debugger where I want to start debugging
"return all features in XML format"
# connect with the external debugger CKS June 8 2008
import pydevd; pydevd.settrace()
doc = amara.create_document()
More information about the Grok-dev