使用Python3.7,我试图捕获一个异常,并通过following an example I found on StackOverflow重新引发它。下面我有两个尝试重新引发异常的异步Python脚本。第一个示例可以工作,它将打印内部和外部异常。exception") from e
Exception: This is the outer exception 然而,在我的下一个Python脚本中,我有多个要排队的任务,我希望从这些任务中获得类似的异常
我能够成功地同步并使用concurrent.futures.ThreadPoolExecutor()编写它。但是,我正在尝试优化它以使用asyncio和httpx,因为它们似乎非常快速地生成数百个http请求。我使用asyncio和httpx编写了以下脚本,但是,我始终得到以下错误:
httpcore.RemoteProtocolError: Server disconnected without sending是什么导致了这一异常,以及如何解决它?tasks.append(asyncio.ensure_future(ge