does os.popen() search the path?

jschmitt at vmlabs.com jschmitt at vmlabs.com
Sat Oct 14 02:27:13 EDT 2000


I'm running Windows2000 here and I'm trying to use os.popen() with
Python 2.0c1.

I've got a tiny little program that tries things like

cmd = os.popen( 'dir' )

I can get things like 'dir', 'cd', 'regedit' to run.  I have a c:\bin
folder where I have things like grep and those don't run at all.  I put
them in the path and if I do

cmd = os.popen( 'set' )

I can get it to print the PATH environment variable and it tells me
that things like 'grep' are in my path.  Yet,

cmd = os.popen( 'grep' )

never launches.

What am I missing?  What's so special about binaries shipped by
Microsoft as part of Win2k that jives with Python that my own programs
don't know about?

Another thing, I can also do this:

cmd = os.popen( 'foo.cmd' )

and the 'foo.cmd' script file runs fine until the script file changes
directory.  That is, as soon as 'foo.cmd' does 'cd somedir'
(and 'somedir' exists), execution of 'foo.cmd' halts.

Would a good wack on the head with the cluestick help?  If so, please
oblige.

John


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list