python / python/cpython

Cannot `os.spawnl` with no arguments

Open
#126,931 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Python 3.8 and 3.11.9

Probably related to: https://github.com/python/cpython/issues/52284
Seems to be the same as: https://github.com/python/cpython/issues/63130

A number of bugs:

    • Doesn't work with no arguements.
>>> os.spawnl(os.P_NOWAIT, "c:\path_to_some_program\app.exe")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen os>", line 930, in spawnl
ValueError: spawnv() arg 2 cannot be empty
  1. If I try and make the arguement empty it also fails. This means that I am forced to send an arguement that may trigger an unknown behaviour in the spawned application.:
>>> os.spawnl(os.P_NOWAIT, "c:\path_to_some_program\app.exe", '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen os>", line 930, in spawnl
ValueError: spawnv() arg 2 first element cannot be empty
  1. If any aspect of this is intended, then the documentation needs to be updated to explicitly say this. Currently it implies any arguments are optional. (Honestly, the docs for this are bad generally.)
CPython versions tested on:

3.11

Operating systems tested on:

Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the os.spawnl implementation shown in the traceback and the corresponding documentation for spawnl and spawnv. Reproduce the Windows cases with no argument and an empty first argument, then determine the intended behavior and update the implementation or documentation so the accepted argument requirements are explicit and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.