Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
在任务之间复制 contextvars.Context
我有一个程序 ASGI 服务器 其结构大致如下 import asyncio import contextvars ctxvar contextvars ContextVar ctx async def lifepsan ctxvar se
python
asyncawait
pythonasyncio
pythoncontextvars
在 Thread 中使用 asyncio 的问题
如下使用asyncio没有问题 import asyncio async def main await asyncio sleep 1 aaa 1 print aaa loop asyncio get event loop loop run
python
Multithreading
pythonasyncio
如何在 FastAPI 中进行多处理
在提供 FastAPI 请求时 我需要对列表中的每个元素执行一项 CPU 密集型任务 我想在多个 CPU 核心上进行此处理 在 FastAPI 中执行此操作的正确方法是什么 我可以使用标准吗multiprocessing模块 到目前为止我发
python
multiprocessing
pythonasyncio
FastAPI
uvicorn
sys:1: RuntimeWarning: 从未等待协程
我正在尝试编写一个请求处理程序来帮助我以异步模式发送请求 当我使用 Ctrl D 或 exit 关闭 python 终端时它会提示 表明sys 1 RuntimeWarning coroutine was never awaited imp
python
python3x
Asynchronous
pythonasyncio
Coroutine
asyncio 实际上是如何工作的?
这个问题是由我的另一个问题引发的 如何在cdef中等待 https stackoverflow com questions 48989065 how to await in cdef 网络上有大量关于asyncio 但它们都非常肤浅 我找不
python
python3x
pythonasyncio
pythoninternals
asyncio:睡眠亚毫秒间隔
我正在构建一个基于树莓派的设备 它将具有多个应同时工作的并发功能 在这种情况下 使用 asyncio 看起来是一个合理的选择 好吧 我可以用线程用 C 编写所有这些东西 但 python 代码看起来更紧凑 其中一项功能是通过 GPIO 脉冲
python
pythonasyncio
同步睡眠进入 asyncio 协程
我有一个协程如下 async def download downloader DataManager downloader download DataManager download 方法如下 def download self start
python
python3x
Asynchronous
pythonasyncio
无法将可等待传递给 asyncio.run_coroutine_threadsafe
我观察到asyncio run coroutine threadsafe函数不接受一般的可等待对象 我不明白这种限制的原因 观察 import asyncio async def native coro return asyncio cor
python
pythonasyncio
错误的 UDP 校验和没有效果:为什么?
我正在尝试测试 UDP 程序 如果它接收到 UDP 校验和错误的数据 会发生什么情况 奇怪的是 它似乎没有任何效果 并且有效负载被成功接收 至少在 OS X 上是通过环回接口成功接收的 下面是一个示例 其中使用以下方式发送数据SOCK RA
python
python3x
Sockets
udp
pythonasyncio
如何找到哪个 Future 导致“Future 异常从未检索到”
15 29 19 Future exception was never retrieved future
python
pythonasyncio
如何在超时的情况下迭代异步迭代器?
我觉得用代码更容易理解 try async for item in timeout something timeout 60 await do something useful item except asyncio futures Tim
python3x
pythonasyncio
如何通过 Asyncio 使用 Python 内置日志记录(权限错误)
我每天晚上都使用 TimedRotatingFileHandler 从日志记录到新文件 根据记录文档 https docs python org 2 library logging handlers html timedrotatingfi
python
logging
WebSocket
pythonasyncio
Python 异步 io 流
我正在查看 asyncio 文档中的以下代码 import asyncio async def tcp echo client message reader writer await asyncio open connection 127
python3x
Sockets
TCP
asyncawait
pythonasyncio
Aiohttp、Asyncio:运行时错误:事件循环已关闭
我有两个脚本 scraper py 和 db control py 在 scraper py 我有这样的东西 def scrape category field pages search use proxy proxy file loop
python
python3x
pythonasyncio
aiohttp
RuntimeError:异常被忽略:
这个问题在这里已经有答案了 我在用aiohttp asyncio and 代码定时发出并发请求 我最近将 Python 升级到版本 3 9 0 并且收到 RuntimeError Event Loop is close after the
python
python3x
asyncawait
pythonasyncio
aiohttp
运行时错误:事件循环正在运行
当我调用该函数时出现以下错误send message Exception in thread Thread 1 Traceback most recent call last File usr lib python3 4 threading
python3x
pythonasyncio
Python 3.5 async/await 与真实代码示例
我读过大量关于 Python 3 5 async await 的文章和教程 我不得不说我很困惑 因为有些使用 get event loop 和 run until complete 有些使用 Ensure future 有些使用 async
python
Asynchronous
asyncawait
python35
pythonasyncio
同步调用协程
想象一下以下非常常见的情况 您编写了一个又长又复杂的函数 并意识到一些代码应该提取到一个单独的函数中以便重用和 或可读 通常 这个额外的函数调用不会改变程序的语义 但是 现在假设您的函数是一个协程 并且您要提取的代码至少包含一个异步调用 现
python3x
pythonasyncio
AWS lambda 与 python asyncio。事件循环闭合问题?
关闭 aws lambda 中的事件循环会影响未来的 lambda 运行吗 我有一些 aysncio python 代码在 aws lambda 服务中运行 代码逻辑如下 def lambda handler event context l
python
amazonwebservices
awslambda
pythonasyncio
从 asyncio StreamReader 读取
我正在尝试扩展使用流式读取器 写入器的 python asyncio HTTP 服务器示例 code https docs python org 3 4 library asyncio stream html tcp echo server
python
http
server
pythonasyncio
«
1
2
3
4
5
6
7
...14
»