microsoft / xlang

MIT License
875 stars 103 forks source link

Python/winrt: can't import winrt in jupyter notebook: 无法在设置线程模式后对其加以更改 #757

Closed oxygen-dioxide closed 1 year ago

oxygen-dioxide commented 3 years ago

image

dlech commented 3 years ago

Translation of error: "Cannot change thread mode after setting it"

This sounds like a duplicate of #690.

Here is a potential workaround:

from winrt import _winrt

_winrt.uninit_apartment()
oxygen-dioxide commented 3 years ago

Your code doesn't work for me image

However, if I use importlib.import, it works.

import importlib
_winrt=importlib.import_module("winrt._winrt")
_winrt.uninit_apartment()
import winrt
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.