Фатальная ошибка Python при использовании потоков ввода и демонов ⇐ Python
-
Гость
Фатальная ошибка Python при использовании потоков ввода и демонов
When I run this code on Windows 11 on Python 3.11.3 it runs fine, but if I import typing in reader.py I get this error:
Fatal Python error: _enter_buffered_busy: could not acquire lock for at interpreter shutdown, possibly due to daemon threads Python runtime state: finalizing (tstate=0x00007fff13ab6960) Current thread 0x00003944 (most recent call first): main.py:
from typing import Generic, TypeVar import reader VALUE = TypeVar("VALUE") class BaseClass(Generic[VALUE]): def __init__(self): pass class SubClass(BaseClass[None]): pass reader.start_reading() reader.py:
# BUG: I get an error when I uncomment this import: # import typing from sys import stdin from threading import Thread def read(): stdin.buffer.read() def start_reading(): Thread(target=read, daemon=True).start() Does anyone have any idea what's going on here? I'm very confused.
Источник: https://stackoverflow.com/questions/780 ... on-threads
When I run this code on Windows 11 on Python 3.11.3 it runs fine, but if I import typing in reader.py I get this error:
Fatal Python error: _enter_buffered_busy: could not acquire lock for at interpreter shutdown, possibly due to daemon threads Python runtime state: finalizing (tstate=0x00007fff13ab6960) Current thread 0x00003944 (most recent call first): main.py:
from typing import Generic, TypeVar import reader VALUE = TypeVar("VALUE") class BaseClass(Generic[VALUE]): def __init__(self): pass class SubClass(BaseClass[None]): pass reader.start_reading() reader.py:
# BUG: I get an error when I uncomment this import: # import typing from sys import stdin from threading import Thread def read(): stdin.buffer.read() def start_reading(): Thread(target=read, daemon=True).start() Does anyone have any idea what's going on here? I'm very confused.
Источник: https://stackoverflow.com/questions/780 ... on-threads