Closed
Description
Describe the bug
Using pyinstaller to build a binary of an application that uses r.set_loop_type("asyncio") causes a stacktrace when running the binary, but not when running it just with python.
To Reproduce
Steps to reproduce the behavior:
- Make asyncio code
# mycode.py
import asyncio
from rethinkdb import r
async def close():
exit()
async def changefeed():
""" Continuously receive updates as they occur """
r.set_loop_type('asyncio')
conn = await r.connect(host="127.0.0.1", password="password", db="test")
table = r.table('table')
cursor = await table.changes(include_initial=True).run(conn)
async for data in cursor:
new = data.get("new_val", {})
print(new)
def do_stuff():
""" Output changes """
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(changefeed())
except KeyboardInterrupt:
loop.run_until_complete(close())
- compile to binary
#!/bin/sh
pyinstaller --onefile mycode.py
- run the binary
mycode.exe
Traceback (most recent call last):
File "mycode.py", line 9, in connect
r.set_loop_type('asyncio')
File "site-packages\rethinkdb\__init__.py", line 69, in set_loop_type
File "site-packages\pkg_resources\__init__.py", line 1134, in resource_exists
File "site-packages\pkg_resources\__init__.py", line 1404, in has_resource
File "site-packages\pkg_resources\__init__.py", line 1472, in _has
NotImplementedError: Can't perform this operation for unregistered loader type
Expected behavior
I expected it to work as a binary, since it works when calling the code with python
System info
- OS: Windows 10
- RethinkDB Version: 2.4.0 (running in docker)
- Python 3.8.2
Additional context
packages installed:
- rethinkdb 2.4.7
- pyinstaller 3.6