[Zope] Zope hangs on string compared to '##'

Chris Withers chrisw at nipltd.com
Mon Sep 15 10:29:14 EDT 2003


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




More information about the Zope mailing list