# RuntimeError: 在另一个循环运行时无法运行事件循环

- **ID:** `python/asyncio-cannot-reenter-running-loop`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在已在运行循环上执行的协程中调用 loop.run_until_complete() 或 asyncio.run()。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.7+ | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   async def outer():
    result = await inner_coro()  # no nested loop
   ```
2. **** (82% 成功率)
   ```
   import asyncio, concurrent.futures
loop = asyncio.get_running_loop()
with concurrent.futures.ThreadPoolExecutor() as pool:
    result = await loop.run_in_executor(pool, lambda: asyncio.run(inner_coro()))
   ```

## 无效尝试

- **** — asyncio.run() refuses when a loop is already running and raises the same error. (90% 失败率)
- **** — Same restriction: you cannot nest loop runners on the same thread. (85% 失败率)
