Skip to content

Pyinstaller compiled binary causes NotImplementedError on r.set_loop_type() #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Inveracity opened this issue May 22, 2020 · 0 comments · Fixed by #204
Closed

Pyinstaller compiled binary causes NotImplementedError on r.set_loop_type() #201

Inveracity opened this issue May 22, 2020 · 0 comments · Fixed by #204
Labels
bug Something isn't working not qualified The issue is not checked yet by the owners

Comments

@Inveracity
Copy link
Contributor

Inveracity commented May 22, 2020

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:

  1. 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())
  1. compile to binary
#!/bin/sh
pyinstaller --onefile mycode.py
  1. 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
@Inveracity Inveracity added bug Something isn't working not qualified The issue is not checked yet by the owners labels May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not qualified The issue is not checked yet by the owners
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant