You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
I know there are probably plenty of issues addressing this problem, but still i didn't figure out how to fix this.
tying to work with nested event-loops more in de code example :
This code snippet throws the following error:
^CTraceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
RuntimeError: cannot enter context: <_contextvars.Context object at %> is already entered
Obviously if i take out the nest_asyncio.apply() i get this error : RuntimeError: This event loop is already running
*also tried it with the util.patchAsyncio()
OS : linux
python version : 3.10
ib-insync version : 0.9.70
So how am i supposed to handle this ?
Now the fun part :
Take the same code and run it on :
OS : Windows 10
python version : 3.10
ib-insync version : 0.9.70
and magic starts happening.... it works ?!
would be thankful if someone could help.
best regards Lucas
The text was updated successfully, but these errors were encountered:
The issue is a blocking call (whatIfOrder) inside the onData event handler. This is easily remedied by using whatIfOrderAsync instead and turning the event handler into a coroutine (async def onData). There is no nesting needed.
The code should fail on Windows as well. Perhaps it was tried with placeOrder instead, which happens to be a non-blocking method and works as-is.
Hi there,
I know there are probably plenty of issues addressing this problem, but still i didn't figure out how to fix this.
tying to work with nested event-loops more in de code example :
![image](https://user-images.githubusercontent.com/56082086/166814200-cd1bfa12-80d7-4bb1-a1c3-76a4565813e3.png)
This code snippet throws the following error:
^CTraceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
RuntimeError: cannot enter context: <_contextvars.Context object at %> is already entered
Obviously if i take out the nest_asyncio.apply() i get this error : RuntimeError: This event loop is already running
*also tried it with the util.patchAsyncio()
OS : linux
python version : 3.10
ib-insync version : 0.9.70
So how am i supposed to handle this ?
Now the fun part :
Take the same code and run it on :
OS : Windows 10
python version : 3.10
ib-insync version : 0.9.70
and magic starts happening.... it works ?!
would be thankful if someone could help.
best regards Lucas
The text was updated successfully, but these errors were encountered: