Fix torch errors - #3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bed2d7a419
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if sys.platform == 'win32' and hasattr(sys, '_MEIPASS'): | ||
| torch_lib = os.path.join(sys._MEIPASS, 'torch', 'lib') | ||
| if os.path.isdir(torch_lib): | ||
| os.add_dll_directory(torch_lib) |
There was a problem hiding this comment.
Persist DLL directory handle in runtime hook
os.add_dll_directory() returns a handle that must remain alive for the directory to stay on the DLL search path, but this call discards the handle immediately. On Windows/CPython that means the added torch/lib path can be removed before torch is imported from the app, so the original WinError 1114 failure can still occur despite this hook. Store the returned handle in a module-level variable (or list) for process lifetime.
Useful? React with 👍 / 👎.
No description provided.