Using os.popen with other python scripts

Blake Winton bwinton at tor.dhs.org
Tue May 4 20:37:53 EDT 1999


On Tue, 4 May 1999 14:24:07 -0400, William Park <parkw at better.net> wrote:
>I'm not familiar with NT system.  But, don't have to specify "python"
>interpretor somewhere when you invoke script1?  Perhaps, script1.py is
>missing
>    #!/usr/local/bin/python
>or script2.py needs 
>    os.popen('python script1.py').readlines()

Not if the proper associations are set up in the registry...
I run most of my python programs by typing "program.py".
(But it's getting to be a pain renaming them all to "program.py"
 whenever I want to run them.)

Although, breaking it out into two statements wouldn't be a bad idea.
i.e.:
spam = os.popen('script1.py')
spam.readlines()

Say, is script1.py in your path?  You might also check the value of the
current directory (os.curdir), and make sure script1.py is somewhere in
there.

Later,
Blake.





More information about the Python-list mailing list