RE: [Zope] error with simple python script loop
I tried to reproduce your '4 iteration' problem on my Zope 2.9.2 installation, but even by removing the 'return' statement I still got 2 loop iterations (and 2 emails).
I have never written a python script that did not have a 'return' statement. I don't know if it is mandatory or not. I usually use python scripts as subroutines/functions and I always have a return statement (even if it is a bare return - ie. the return statement does not send back any data).
As Andreas suggested, if you want to track this down you are going to have to use a debugger like pdb.
I have test the script on my local windows python version with an print statement, and it works fine - everytime - so its only on zope. i cant use pdb on zope´s python script i think?
I have test the script on my local windows python version with an print statement, and it works fine - everytime - so its only on zope. i cant use pdb on zope´s python script i think? Are you using the same mail servers?
Anyway, another thing you could do would be to run the script in debug mode: ''' <home_instance>/bin/zopectl debug Starting debugger (the name "app" is bound to the top-level Zope object) app.YourScript ''' You could perhaps trying to do a fresh install of python and zope (from sources) in your debian server and see if it works. Regards Josef
On Fri, Nov 24, 2006 at 02:46:25PM +0100, Christian Steinhauer wrote:
... i cant use pdb on zope´s python script i think?
Normally true, but you can google for Chris Withers' "zdb" product which allows debugging from scripts very nicely. --PW
Paul Winkler wrote:
On Fri, Nov 24, 2006 at 02:46:25PM +0100, Christian Steinhauer wrote:
... i cant use pdb on zope´s python script i think?
Normally true, but you can google for Chris Withers' "zdb" product which allows debugging from scripts very nicely.
http://www.simplistix.co.uk/software/zope/zdb Sadly doesn't work with .cpy's in Plohn... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Christian Steinhauer, on 2006-11-24:
i cant use pdb on zope´s python script i think?
You can, if you put this small (two lines) program in your Products dir: svn://svn.zope.org/repos/main/Products.enablesettrace Not meant for production sites. -- Maurits van Rees | http://maurits.vanrees.org/ [NL] Work | http://zestsoftware.nl/ "Do not worry about your difficulties in computers, I can assure you mine are still greater."
On Tue, Nov 28, 2006 at 08:28:47AM +0000, Maurits van Rees wrote:
Christian Steinhauer, on 2006-11-24:
i cant use pdb on zope?s python script i think?
You can, if you put this small (two lines) program in your Products dir:
svn://svn.zope.org/repos/main/Products.enablesettrace
Not meant for production sites.
I still prefer zdb, because you can actually see and step through the script code. http://www.simplistix.co.uk/software/zope/zdb -- Paul Winkler http://www.slinkp.com
Paul Winkler wrote:
I still prefer zdb, because you can actually see and step through the script code. http://www.simplistix.co.uk/software/zope/zdb
It also includes the security declarations necessary to import it from untrusted code :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers, on 2006-11-28:
Paul Winkler wrote:
I still prefer zdb, because you can actually see and step through the script code. http://www.simplistix.co.uk/software/zope/zdb
Do you mean you can put this in a .cpy file: from Products.zdb import set_trace set_trace() and then you can see the script code in the debugger? When I try that I end up in the debugger, but I don't see anything different from the normal pdb.set_trace(). When I press 'l' I just see [EOF] like always. Is there a trick I am missing? It *would* be neat! :)
It also includes the security declarations necessary to import it from untrusted code :-)
Those security declarations are actually the only thing that svn://svn.zope.org/repos/main/Products.enablesettrace itself does. -- Maurits van Rees | http://maurits.vanrees.org/ [NL] Work | http://zestsoftware.nl/ "Do not worry about your difficulties in computers, I can assure you mine are still greater."
Maurits van Rees wrote:
Chris Withers, on 2006-11-28:
Paul Winkler wrote:
I still prefer zdb, because you can actually see and step through the script code. http://www.simplistix.co.uk/software/zope/zdb
Do you mean you can put this in a .cpy file:
If you go back in the thread, you'll see I explicitly stated that .cpy's are not covered because they choose to do their own silly thing.
from Products.zdb import set_trace set_trace()
and then you can see the script code in the debugger?
For normal python skin scripts, yes :-)
When I try that I end up in the debugger, but I don't see anything different from the normal pdb.set_trace(). When I press 'l' I just see [EOF] like always. Is there a trick I am missing?
Yeah, don't use .cpy's ;-)
It *would* be neat! :)
It would indeed, it'd just require more monkeypatching of the same style that zdb does already. Reading zdb's code, particular the bits that cover skin .py's should give you a good start. I'd happilly accept patches to zdb and am keen to roll a new release if someone does provide such a patch.
Those security declarations are actually the only thing that svn://svn.zope.org/repos/main/Products.enablesettrace itself does.
I noticed ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (5)
-
Chris Withers -
Christian Steinhauer -
Josef Meile -
Maurits van Rees -
Paul Winkler