Related to os module

Alex Martelli aleaxit at yahoo.com
Sun Dec 10 13:27:56 EST 2000


"Venkatesh Prasad Ranganath" <rvprasad at cis.ksu.edu> wrote in message
news:m3k898yxaj.fsf at boss.dreamsoft.com...
> Hi,
>
> Following is the code in question
>
> >>>import os
> >>>os.execv("/bin/ls", ["-l"])
>
> The output should be that of executing "ls -l" instead it is of "ls".
"-l" is
> being discarded.  What might be wrong?

The program-name must be repeated as the first item in the arguments-list.

    os.execv('/bin/ls', ['ls', '-l'])

should do.


Alex






More information about the Python-list mailing list