portable way to tell what Popen will call

Ville M. Vainio vivainio at gmail.com
Wed May 14 05:59:44 EDT 2008


Brendan Miller <catphive at catphive.net> writes:

> For instance on unix systems, Popen will work for files flagged with
> the executable bit, whereas on windows Popen will work on files
> ending the in .exe extension (and I don't think anything else). Is
> there a portable way

Actually, if you pass the use_shell = 1 argument to Popen, it will
launch the process using a shell - that is, what you expect to work in
a shell (and consequently os.system()) will work.

> to check what Popen will work on without actually execute it? Do I
> have to write a bunch of platform specific code here?

Unfortunately, you'll probably need to write platform specific kludges
for this.



More information about the Python-list mailing list