I am trying to get ib_insync "working" within a nameko service, so far without succcess.
I have tried to patch asyncio(), still does not work, failing at the imports.
import asyncio
from ib_insync import IB, util
from ib_insync.contract import * # noqa
util.patchAsyncio()
Any help/suggestion is appreciated.
_|File "/usr/local/bin/nameko", line 8, in
| sys.exit(main())
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/main.py", line 112, in main
| args.main(args)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/commands.py", line 110, in main
| main(args)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/run.py", line 181, in main
| import_service(path)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/run.py", line 46, in import_service
| import(module_name)
| from ib_insync import IB, util
|File "/usr/local/lib/python3.6/site-packages/ib_insync/init.py", line 7, in
| from eventkit import Event
|File "/usr/local/lib/python3.6/site-packages/eventkit/init.py", line 4, in
| from .event import Event
|File "/usr/local/lib/python3.6/site-packages/eventkit/event.py", line 7, in
| from .util import NO_VALUE, loop
|File "/usr/local/lib/python3.6/site-packages/eventkit/util.py", line 19, in
| loop = asyncio.get_event_loop()
|File "/usr/local/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
| return get_event_loop_policy().get_event_loop()
|File "/usr/local/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
| % threading.currentthread().name)
| RuntimeError: There is no current event loop in thread 'MainThread'.
I am trying to get ib_insync "working" within a nameko service, so far without succcess.
I have tried to patch asyncio(), still does not work, failing at the imports.
Any help/suggestion is appreciated.
_|File "/usr/local/bin/nameko", line 8, in
| sys.exit(main())
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/main.py", line 112, in main
| args.main(args)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/commands.py", line 110, in main
| main(args)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/run.py", line 181, in main
| import_service(path)
|File "/usr/local/lib/python3.6/site-packages/nameko/cli/run.py", line 46, in import_service
| import(module_name)
| from ib_insync import IB, util
|File "/usr/local/lib/python3.6/site-packages/ib_insync/init.py", line 7, in
| from eventkit import Event
|File "/usr/local/lib/python3.6/site-packages/eventkit/init.py", line 4, in
| from .event import Event
|File "/usr/local/lib/python3.6/site-packages/eventkit/event.py", line 7, in
| from .util import NO_VALUE, loop
|File "/usr/local/lib/python3.6/site-packages/eventkit/util.py", line 19, in
| loop = asyncio.get_event_loop()
|File "/usr/local/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
| return get_event_loop_policy().get_event_loop()
|File "/usr/local/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
| % threading.currentthread().name)
| RuntimeError: There is no current event loop in thread 'MainThread'.