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', "rec@mail.com", "sender@mail.com", 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.
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.
So try without return, eg.: 1. create ZPT with id: 'counter' 2. edith 'counter' that it contains only '0' 3. Create Script (Python): val = context.counter() v = int(val)+1 context.counter.write(str(v)) and test this script with/without return. Then see what value is in 'counter' ZPT. I have always only +1 increment, and you? -- Maciej Wisniowski
participants (2)
-
Christian Steinhauer -
Maciej Wisniowski