Skip to content

Fix launch() with locate=True for paths containing spaces on Windows#3307

Closed
Bahtya wants to merge 1 commit intopallets:mainfrom
Bahtya:fix/launch-spaces-windows
Closed

Fix launch() with locate=True for paths containing spaces on Windows#3307
Bahtya wants to merge 1 commit intopallets:mainfrom
Bahtya:fix/launch-spaces-windows

Conversation

@Bahtya
Copy link
Copy Markdown

@Bahtya Bahtya commented Apr 4, 2026

Problem

On Windows, click.launch(path, locate=True) builds the command:

explorer /select,C:\My Documents\file.txt

When the path contains spaces, Windows Explorer misinterprets it and opens the wrong location or fails silently.

Solution

Wrap the path in double quotes:

args = ["explorer", f'/select,"{url}"']

Previous attempt in #3216 was closed without merging.

Fixes #2994

When path contains spaces, Windows Explorer misinterprets the /select
argument. Wrap the path in double quotes so Explorer handles it correctly.

Fixes pallets#2994
@davidism davidism closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch() cannot locate files with spaces in the name on Windows

2 participants