----- Original Message ----- From: "Christian Steinhauer" <[EMAIL PROTECTED]>
To: "Jonathan" <[EMAIL PROTECTED]>; <zope@zope.org>
Sent: Friday, November 24, 2006 8:19 AM
Subject: Re: [Zope] error with simple python script loop


I just cut and pasted your code into a python script on my
Zope installation
(2.9.2) and it worked as expected (ie. 2 emails sent). So
something is
pooched in your installation.

A quick way to check to see if your script is looping more
than you expect
is to do something like:

loopCheck = []
for i in range(2):
 subj = str(i) + ' range python'
 context.MailHost.send('range test with python', "[EMAIL PROTECTED]",
"[EMAIL PROTECTED]", subj)
 loopCheck.append(subj)
return loopCheck

If you are getting only 2 iterations of the loop (as it
should be), then
something is wrong with your MailHost (if this is the case
try deleting it
and re-adding it).  Another test: place a local copy of
MailHost in the same
folder as your script and see what happens.

Hi Jonathan, thanks for taking care of the problem. I have done the self test you do with the list. But everytime when something is written at last line, example return 'eof' (My example in the topic) the error did not occured - so the list gives me 2 and i will get 2 emails.

The error only occured when nothing is written under the loop.

I have 2 real separeted dedicated servers, one with zope 2.6.4 and one with 2.10 - the problem occured on both servers. So i used the zope product "MailDropHost" too and get the self error on both server. With MailDropHost i can see a spooler - thats nice - but in the spooler i see 4 emails. So the Operating System or Exim get 4 Mails from Zope/Python.
I´m using Debian Linux.

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.

Jonathan



_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to