Skip to content

[rejected AI] Fix Windows click.edit notepad launch failures - #3856

Closed
seethinajayadileep wants to merge 2 commits into
pallets:mainfrom
seethinajayadileep:fix/3840-windows-click-edit-notepad
Closed

[rejected AI] Fix Windows click.edit notepad launch failures#3856
seethinajayadileep wants to merge 2 commits into
pallets:mainfrom
seethinajayadileep:fix/3840-windows-click-edit-notepad

Conversation

@seethinajayadileep

Copy link
Copy Markdown

Problem

On Windows, click.edit() intermittently fails when launching the default editor (notepad). CreateProcess raises WinError 87 (parameter is incorrect) or WinError 14001 (side-by-side configuration incorrect). The default editor string was the bare name "notepad", and POSIX shlex.split can also mangle unquoted Windows paths that contain backslashes.

Solution

  • Resolve the default Windows editor to a real notepad.exe path via shutil.which, falling back to %SystemRoot%\\System32\\notepad.exe (or %WINDIR% / C:\\Windows).
  • When launching on Windows with notepad or an unquoted drive-letter path, build argv with shlex.split(..., posix=False) so backslashes are preserved for CreateProcess.
  • Keep merging self.env into a copy of os.environ (unchanged).
  • Add unit tests covering get_editor() resolution and argv construction for the System32 notepad path.

Fixes #3840

JAYA DILEEP added 2 commits September 7, 2026 16:42
Resolve notepad.exe to a full System32 path on Windows and launch via
a proper argv list so CreateProcess no longer fails intermittently
with WinError 87/14001.

Fixes pallets#3840

Signed-off-by: JAYA DILEEP <seethinajayadileep@hotmail.com>
Signed-off-by: JAYA DILEEP <seethinajayadileep@hotmail.com>
@davidism

davidism commented Sep 7, 2026

Copy link
Copy Markdown
Member

@davidism davidism closed this Sep 7, 2026
@davidism davidism added the rejected AI Contribution rejected because of its untrustworthy AI origin label Sep 7, 2026
@davidism davidism changed the title Fix Windows click.edit notepad launch failures [rejected AI] Fix Windows click.edit notepad launch failures Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

click.edit on Windows throws WinError 14001 or 87

2 participants