[Grok-dev] Re: Suggestions or advice for how to debug a grok
app using PyDev?
Craeg Strong
cstrong at arielpartners.com
Mon Jun 2 10:01:03 EDT 2008
Thanks for the reply!
I am glad to hear you got it working, but I am confused by the
references to Zope2 below.
Does that mean you are using Zope 3 and Grok via Five?
That might mean you are using Zope's http server rather than Twisted,
which means you have a different main class / entry point.
Is that a correct analysis?
Still, I would be interested in your debug setup-- which is the main
class? It appears to me that for eclipse PyDev debugging, the main
class has to be an actual python class that is directly visible to
eclipse. That is, you cannot pick a script like "zopectl" or "runzope"
nor a python class that is not within your source folders, nor a class
that is hidden inside a binary egg.
For that reason as well as code completion as you mentioned, you are
obliged to add everything to PYTHONPATH (somewhere around 100 source
folders and 15 binary eggs I believe-- not a biggie but definitely
something to be automated).
Martin Aspeli wrote:
> 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.
When you start the debug server, you must specify a main entry point to
PyDev, and selection of a run directory is also apparently crucial.
I specified zope.app.twisted.main with everything in PYTHONPATH and my
run directory to that of my custom app (where "bin/zopectl" lives) but
still got some strange messages suggesting missing arguments or parameters.
Curious as to what you set your main entry point and your run directory to.
--Craeg
More information about the Grok-dev
mailing list