Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

venv creation fails when `sys.executable == ''`

Open Beginner friendly
#943 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
tooling

Research direction

Start in python-stdlib/venv/venv/main.py around line 93 and reproduce the case where sys.executable is an empty string. Check the venv creation path and confirm it handles that value without attempting the failing copy command. Done when venv creation succeeds in this environment and the existing executable case remains supported.

Written by the indexing model from the issue text.

Description

needs-info

from venv

    # Add a `micropython` binary in $PATH pointing to this binary.
    if hasattr(sys, "executable"):
        os.system("cp {} {}".format(sys.executable, venv_bin_path + os.sep + "micropython"))

but on my local copy this happens

MicroPython v1.24.0 on 1980-01-01; darwin [GCC 4.2.1] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import sys
>>> sys.executable
''
>>>

so maybe it is best to add and sys.executable to the check?

    if hasattr(sys, "executable") and sys.executable:
Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 4h
Merged PRs (30d)
4

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.

More from micropython/micropython-lib

All issues in micropython/micropython-lib

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.