Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot change thread mode after it is set" RunTime error in Python #761

Closed
VellichorPrism opened this issue Sep 27, 2021 · 1 comment
Closed

Comments

@VellichorPrism
Copy link

I created a project that displays a Windows toast notification. When I run my code in PyCharm, the script executes normally until completion. After compiling using PyInstaller and running the generated exe, I get an error for one of the 'winrt' imports:

Traceback (most recent call last):
  File "notification.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "message.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "winrt\__init__.py", line 4, in <module>
RuntimeError: Cannot change thread mode after it is set.
[9720] Failed to execute script 'notification' due to unhandled exception!

My imports for 'winrt' are:

import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom

If anyone one knows why I get this error, I would appreciate any help!

@dlech
Copy link
Contributor

dlech commented Sep 27, 2021

See #690.

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

No branches or pull requests

2 participants