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")
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

...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!
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to