Zope hangs on string compared to '##'
Hi, 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 '#' What am I missing? Regards Christoph
Christoph Landwehr wrote:
Hi,
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.
That's because while is a loop too ;-) (again in Google mode ;-) Did you mean: from string import split lines=string.split(str(container.my_script.read()),'\n') for line in lines: if line.startswith('##'): print line[0:2] print '<br>' print '# ENDE of bindings' return printed cheers, Chris
participants (2)
-
Chris Withers -
Christoph Landwehr