execvpe weirdness
Nathan Gray
n8gray at caltech.edu.is.my.e-mail.address
Wed Feb 21 00:09:46 EST 2001
Nathan Gray wrote
> OK, thanks to a dejanews search I figured out that I need to say:
> execvpe(execName, [execName], os.environ)
> or
> execle(execName, execName, os.environ)
>
> and I think I even understand why -- it's so you can call an executable
> with something other than the name of the executable as argv[0]. I can
> sorta see why this is useful, but it would be nice if the documentation
> for exec* was a little more explicit about the nature of "arg0". A line
> like: "Note: arg0 is traditionally the name of the executable, and
> some executables will depend on this." would have saved me a lot of
> hair-pulling.
>
> Or have I misunderstood something?
>
> -n8
Since we've already decided that flaming onesself is inappropriate on
this newsgroup <wink>, I'll simply point out to poor Nathan that the
documentation in 2.0 is much better on the exec* functions.
"""
The various exec*() functions take a list of arguments for the new
program loaded into the process. In each case, the first of these
arguments is passed to the new program as its own name rather than as an
argument a user may have typed on a command line. For the C programmer,
this is the argv[0] passed to a program's main(). For example,
"os.execv('/bin/echo', ['foo', 'bar'])" will only print "bar" on
standard output; "foo" will seem to be ignored.
"""
Maybe I'll make a witty remark about the time machine, too.
In response, Nathan will say that although the documentation is indeed
better for 2.0, it's still a bit confusing for those who don't program
in C, and he thinks that his suggestion still might help.
To which I'll respond that if he wants to see this happen he should
really send his suggestion to python-docs at python.org. Depending on my
mood, I may also chastise him for not looking for the correct venue
before posting.
With a mild air of indignity he'll reply that he already *has* sent his
suggestion to python-docs at python.org.
I'll then apologize, and the two of us will co-write, co-direct, and
co-star in a movie about long-separated twin cops who reunite to track
down a wacky gang of incompetent jewel thieves.
Thanks for tuning in,
-n8
--
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._
Nathaniel Gray
California Institute of Technology
Computation and Neural Systems
n8gray <at> caltech <dot> edu
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._
More information about the Python-list
mailing list