Skip to content

fix(i18n): clear _PYI_APPLICATION_HOME_DIR (correct env var for PyI 6.x)#50

Merged
nelsonduarte merged 1 commit into
mainfrom
fix/i18n-pyi-home-dir-env
May 8, 2026
Merged

fix(i18n): clear _PYI_APPLICATION_HOME_DIR (correct env var for PyI 6.x)#50
nelsonduarte merged 1 commit into
mainfrom
fix/i18n-pyi-home-dir-env

Conversation

@nelsonduarte
Copy link
Copy Markdown
Owner

Summary

Follow-up to #49. PyInstaller 6.x renamed the env var that drives the temp-extraction handoff between parent and child from `_MEIPASS2` to `_PYI_APPLICATION_HOME_DIR`. The original PR cleared only the legacy name, which has no effect on the build we actually ship (PyInstaller 6.19).

Evidence

```
$ strings venv/Lib/site-packages/PyInstaller/bootloader/Windows-64bit-intel/runw.exe
| grep -i 'meipass|pyi_application'
_PYI_APPLICATION_HOME_DIR
_PYI_APPLICATION_HOME_DIR environment variable is not defined!
Failed to get _MEIPASS as PyObject.
_MEIPASS
```
No reference to `_MEIPASS2` in the modern bootloader. `_MEIPASS` is read inside Python (sys._MEIPASS) but isn't the inter-process handoff variable.

Fix

Clear both env var names before `startDetached()`:

  • `_PYI_APPLICATION_HOME_DIR` — current (PyInstaller 5.x onward)
  • `_MEIPASS2` — legacy (older PyInstaller)

So the fix works regardless of which PyInstaller version we ship with.

Why ship inside v1.13.10 (not bump again)

Tag `v1.13.10` has not been pushed yet — main is still in the pre-release window. No need to bump version twice.

Test plan

  • Local build + smoke test (already passed)
  • User confirms language switch works after this lands
  • Tag v1.13.10 only after this PR is merged

🤖 Generated with Claude Code

Follow-up to #49. PyInstaller 6.x renamed the temp-extraction handoff
env var from _MEIPASS2 to _PYI_APPLICATION_HOME_DIR. Verified by
extracting strings from the runw.exe bootloader shipped with
PyInstaller 6.19. Clearing only _MEIPASS2 had no effect on modern
builds, so the language-change relaunch crash could still surface.

Clear both names (legacy + current) so the fix works regardless of
the PyInstaller version we ship with.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nelsonduarte nelsonduarte merged commit 63e2f78 into main May 8, 2026
3 checks passed
@nelsonduarte nelsonduarte deleted the fix/i18n-pyi-home-dir-env branch May 8, 2026 15:43
nelsonduarte added a commit that referenced this pull request May 10, 2026
…unch (#57)

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

1 participant