Using os.popen with other python scripts

Tom Bryan tbryan at zarlut.utexas.edu
Tue May 4 13:42:56 EDT 1999


It works for me: Python 1.5.1, Solaris 2.5. (output below)
There must be a problem with your setup.

Does script1.py work from the command line?
Have you tried it in two steps?
temp = os.popen('script1.py')
print temp
x = temp.readlines()
print x



> cat script1.py
#!/opt/bin/python
print "this is a test"
> python
Python 1.5.1 (#3, Mar  7 1999, 20:11:49)  [GCC 2.7.2] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import os
>>> x = os.popen('script1.py').readlines()
>>> print x
['this is a test\012']
>>> 

-- 
tbryan at zarlut.utexas.edu
Remove the z from this address to reply.
Stop spam!  http://spam.abuse.net/spam/




More information about the Python-list mailing list