This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.execvp fails with empty argument list
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: scharf, tim.peters
Priority: normal Keywords:

Created on 2001-05-04 06:54 by scharf, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (2)
msg4643 - (view) Author: Michael Scharf (scharf) Date: 2001-05-04 06:54
This code fails with python 2.1 (it's ok with 1.5):
python -c 'import os;  os.execvp("ls",[])'



Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "/Tools/Python-2.1/lib/python2.1/os.py", line
291, in execvp
    _execvpe(file, args)
  File "/Tools/Python-2.1/lib/python2.1/os.py", line
341, in _execvpe
    apply(func, (fullname,) + argrest)
ValueError: execv() arg 2 must not be empty
msg4644 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-05-04 07:12
Logged In: YES 
user_id=31435

Not a bug.  This is explained in the docs.  The argument 
list cannot be empty because the first entry is passed to 
the program as the program's name (argv[0], in C terms).  
Try execvp("ls",["ls"]) if you want ls to believe its name 
is "ls".
History
Date User Action Args
2022-04-10 16:04:01adminsetgithub: 34456
2001-05-04 06:54:15scharfcreate