GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PowerShell venv activation treats square brackets in paths as wildcards · Issue #159498 · python/cpython

PowerShell venv activation treats square brackets in paths as wildcards #159498

New issue
Copy link
New issue
Copy link
Open
#159499
Open
PowerShell venv activation treats square brackets in paths as wildcards#159498
#159499
Copy link
Labels
OS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-venvRelated to the venv moduleRelated to the venv moduletype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@repzakske
repzakske
opened on Oct 15, 2026
Issue body actions

Bug report

PowerShell activation uses wildcard-aware path lookups for the script directory and pyvenv.cfg. Square brackets in an environment's path can prevent activation or select a similarly named sibling directory.

In an empty temporary directory, run:

python -m venv --without-pip --prompt expected 'project [2026]/.venv'
. '.\project [2026]\.venv\Scripts\Activate.ps1'

Activation reports You cannot call a method on a null-valued expression. It should activate the environment and use the configured prompt.

An existing sibling directory named venv1/Scripts can also cause the internal directory lookup for venv[1]/Scripts to select that sibling instead of the intended environment.

The relevant lookups in Lib/venv/scripts/common/Activate.ps1 use Get-Item -Path, Join-Path -Resolve -Path, and Get-Content -Path. They need to treat filesystem paths literally.

CPython versions tested on

3.15.0 and the 3.16 development branch at fdec4df45ab69fc25019565992d95b26b4e37523, with PowerShell 7.6.5 and Windows PowerShell 5.1.

Operating systems tested on

Windows.

Linked PRs

  • gh-159498: Fix PowerShell venv activation for paths containing brackets #159499

Activity

  1. aisk
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    OS-windows
    topic-venvRelated to the venv moduleRelated to the venv module
    on Oct 16, 2026
  2. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Oct 16, 2026
  3. kevinprimeraquecreo-stack
    added this to Project_VKand Project_VKon Oct 18, 2026
  4. github-project-automation
    moved this to Todo in Project_VKon Oct 18, 2026
  5. github-project-automation
    moved this from Todo to In progress in Project_VKon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-venvRelated to the venv moduleRelated to the venv moduletype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.