IG
Size: a a a
IG
Д
IG
D
Д
Д
IG
IG
MZ
MM
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/14/xd2s)
N
ГГ
MZ
R
# main.py
app = fastapi.FastAPI()
@app.on_event("startup")
async def init_db():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
# test.py
from fastapi.testclient import TestClient
from main import app
@pytest.fixture
def client():
with TestClient(app) as c:
yield c
def test_one(client):
r = client.get("/one")
... # some test where the app has to use the DB
def test_two(client):
r = client.get("/two")
... # some test where the app has to use the DB
СИ
pyperclip.copy(str(text)) увидел text когда for text in listen(): шел не в функции то все работало
def cou():
global counter
counter = 2
time.sleep(0.05)
cou1()
keyboard.add_hotkey('ctrl', lambda: cou())
def listen():
while True:
data = stream.read(4000, exception_on_overflow=False)
if (rec.AcceptWaveform(data)) and (len(data) > 0):
answer = json.loads(rec.Result())
print(str('ок'))
if answer["text"]:
yield answer["text"]
if counter == 2:
pyperclip.copy(str(text)) вот тут не видит text
keyboard.send('ctrl+v')
if answer["text"]:
yield answer["text"]
def list():
for text in listen():
if text == 'тестирую переменную':
sea()
processThread = Thread(target=list, )
processThread.start()