Skip to content

Moved from win10/python 3.10 to win11/python 3.12.3 and get: The current thread apartment type is not MTA: MAIN_STA... #1564

Answered by dlech
vascolp asked this question in Q&A
Discussion options

You must be logged in to vote

To try it, I think you can pip install https://github.com/hbldh/bleak/archive/refs/heads/winrt-allow-sta.zip and then paste the following code snippet in your main python file.

try:
    from bleak.backends.winrt.util import allow_sta
    # tell Bleak we are using a graphical user interface that has been properly
    # configured to work with asyncio
    allow_sta()
except ImportError:
    # other OSes and older versions of Bleak will raise ImportError which we
    # can safely ignore
    pass

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
11 replies
@vascolp
Comment options

@vascolp
Comment options

@dlech
Comment options

dlech May 7, 2024
Collaborator

@dlech
Comment options

dlech May 7, 2024
Collaborator

Answer selected by vascolp
@vascolp
Comment options

@dlech
Comment options

dlech May 7, 2024
Collaborator

@shortcakesweets
Comment options

@dlech
Comment options

dlech Dec 16, 2024
Collaborator

Comment options

You must be logged in to vote
3 replies
@vascolp
Comment options

@mantisbug
Comment options

@mantisbug
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants