[Zope] windows python differences

Gabriel Genellina gagsl-zope at yahoo.com.ar
Fri May 19 03:18:51 EDT 2006


At Thursday 18/5/2006 19:21, garry saddington wrote:

>This code on linux works without a problem
>
>ispell = os.popen("echo " + word +
>| /opt/scholarpack/ancillary/ispell/bin/ispell -a")
>ispell.readline
>sentence = ispell.readline()
>
>if (sentence[0] == '&'):
>
>
>however on windows it throws a string index out of range at the
>sentence[0] constructs.

Well, if 0 is out of range, the string is empty; readline() returns 
an empty string when it gets the EOF before any other thing. (You 
learn this by reading the Python documentation).
So, your popen() call gave you an empty file...

>the popen command on windows is:
>ispell=os.popen("echo" +word+ "\scholarpack\ancillary\ispell\bin\ispell
>-a")

...which is not a surprise, given that command. You must duplicate 
back quotes inside a string, they are used as escape characters. 
Again, read the Python manuals...
Maybe you should investigate the several popen variants, using echo 
to construct the command is a bit crazy...

>Anyone know what the difference is on the two platforms?

Surely! But this is not the problem here.



Gabriel Genellina
Softlab SRL 


		
______________________________________________________ 
Yahoo! Autos. Más de 3.000 vehículos vendidos por mes. 
¿Qué esperás para vender el tuyo? 
Hacelo ahora y ganate un premio de Yahoo! 
http://autos.yahoo.com.ar/vender/


More information about the Zope mailing list