Running into problems with os.popen

Stephen Boulet stephen.boulet at motorola.com
Wed Mar 19 18:44:41 EST 2003


I was using a structure like:

f = os.popen(command)
s = f.read()

but getting:  IOError [Errno 22] Invalid argument.

However, doing it all on the windows command line works:

command += ' > temp.txt'
os.popen(command)
f = open('temp.txt')
s = f.read()
f.close()

The string returned is quite large.

I can get the first way to kind of work by doing:

f = os.popen(command,'rb')
s = f.read()

but then my string is truncated. Anyone know what's going on?

TIA.

-- Stephen





More information about the Python-list mailing list