[Zope] Zope hangs on string compared to '##'
Gabriel Genellina
gagenellina at softlab.com.ar
Mon Sep 15 20:17:54 EDT 2003
At 15/9/2003 09:21, you wrote:
>I habe a python script which is supposed to print the bindings of a python
>method:
>
>from string import split
>x=string.split(str(container.my_script.read()),'\n')
>for i in x:
> while i[0:2] == '##': # Zope hangs if i compared to '##'
> print i[0:2]
> print '<br>'
>print '# ENDE' of bindings'
>return printed
>
>The script seems to get caught in an endless loop and returns no results.
>Sometimes after calling the script Zope does not responde anymore and
>needs to be restarted.
>
>Everything runs finde if I compare i eg. with '#'
The error has nothing to do with Zope, the algorithm is wrong. The loop is
testing the contents of variable 'i' and you don't change 'i' inside it, so
the loop never exits.
Try using "if i..." instead of "while i..."
Test your script standalone, using a python debugger like Pythonwin or
IDLE, and once it works OK upload it into Zope.
Gabriel Genellina
Softlab SRL
More information about the Zope
mailing list