fix(i18n): clear all PyInstaller env vars (not only home dir) on relaunch (v1.13.11)#57
Merged
Merged
Conversation
…unch PR #50 cleared _PYI_APPLICATION_HOME_DIR but left _PYI_PARENT_PROCESS_LEVEL and _PYI_ARCHIVE_FILE inherited. The child bootloader sees _PYI_PARENT_PROCESS_LEVEL=1 from the parent, concludes it is a phase-2 (child-phase) launch, then tries to read _PYI_APPLICATION_HOME_DIR — which we cleared — and aborts with _PYI_APPLICATION_HOME_DIR environment variable is not defined! Switch to a pattern-based clear that removes anything matching _PYI_* or _MEIPASS*, so the relaunched process truly starts fresh and is robust against future PyInstaller versions adding new internal vars. Verified locally with a build + smoke test + relaunch simulation. Bumps APP_VERSION to 1.13.11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shipped a regression in v1.13.10. Changing language on the Store / installer build now pops up:
Root cause
PR #50 cleared `_PYI_APPLICATION_HOME_DIR` but PyInstaller `--onefile` actually uses three internal env vars to coordinate the two-phase bootloader handoff on Windows:
```
$ strings runw.exe | grep PYI
_PYI_ARCHIVE_FILE
_PYI_APPLICATION_HOME_DIR
_PYI_PARENT_PROCESS_LEVEL
```
The child process inherits `_PYI_PARENT_PROCESS_LEVEL=1` from the parent. The bootloader uses that to decide "I am a phase-2 launch, my files have already been extracted, just read `_PYI_APPLICATION_HOME_DIR` to find them". We had just cleared that path → bootloader aborts.
Fix
Replace the two explicit `env.remove("…")` calls with a pattern sweep that drops every key matching `PYI` or `_MEIPASS`. The relaunched process now truly starts as a fresh phase-1 launch and runs its own extraction, which is what we wanted from #49 / #50 in the first place.
Robust against future PyInstaller versions adding new internal vars: anything they prefix with `PYI` gets swept automatically.
Test
Built locally with the fix and ran two empirical checks:
Test plan post-merge
🤖 Generated with Claude Code