micropython / micropython/micropython-lib

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

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

Nobody has claimed this yet.

needs-info
Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

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:

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 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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.