os.spawnve args bug?

Tim Peters tim_one at email.msn.com
Fri Nov 10 16:01:47 EST 2000


[Neil Cerutti]
> ...
> But this next one works, and the first argument is seemingly
> totally ignored by the application:
>
> args = ['dummy', '-create']
>
> Is this a bug or a feature?

Feature, inherited from Unix.  All OS spawn/exec functions work this way.
The current development version of the docs should make this much clearer
(it's darned near a FAQ).

> Am I expected to set args[0] to the path of the executable file?

Depends entirely on the app you're calling.  args[0] becomes argv[0] in the
spawned process, and *some* apps look at that to decide what to do (for
example, on Unix it's common for file compression and decompression
utilities to be links to the same executable, differing only in the name of
the link -- the executable then looks at argv[0] to decide whether it should
compress or decompress).  In doubt, yes, set args[0] to the path of the
executable.

hacks-endure-ly y'rs  - tim






More information about the Python-list mailing list