Related to os module

Alex Martelli aleaxit at
Sun Dec 10 19:27:56 CET 2000

"Venkatesh Prasad Ranganath" <rvprasad at> wrote in message
news:m3k898yxaj.fsf at
> 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.


More information about the Python-list mailing list