nats-rpc / python-nrpc

A python NRPC implementation
MIT License
9 stars 2 forks source link

Not working with python 3.10 #1

Closed gwilherm closed 7 months ago

gwilherm commented 7 months ago

Hello,

Is the library discontinued ? I tried to use the library with python 3.10.12 and I got the following error:

Traceback (most recent call last):
  File "/home/gwilherm/git/python-nrpc/examples/helloworld/main.py", line 32, in <module>
    asyncio.run(run())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/gwilherm/git/python-nrpc/examples/helloworld/main.py", line 17, in run
    await nc.connect('nats://localhost:4222')
  File "/home/gwilherm/git/python-nrpc/venv/lib/python3.10/site-packages/nats/aio/client.py", line 310, in connect
    self._flush_queue = asyncio.Queue(
  File "/usr/lib/python3.10/asyncio/queues.py", line 34, in __init__
    super().__init__(loop=loop)
  File "/usr/lib/python3.10/asyncio/mixins.py", line 17, in __init__
    raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Queue() since it is no longer necessary

I also tried this:

pip uninstall asyncio-nats-client
pip install nats-py

And now:

Traceback (most recent call last):
  File "/home/gwilherm/git/python-nrpc/examples/helloworld/main.py", line 5, in <module>
    import helloworld_nrpc
  File "/home/gwilherm/git/python-nrpc/examples/helloworld/helloworld_nrpc.py", line 6, in <module>
    import nrpc
  File "/home/gwilherm/git/python-nrpc/venv/lib/python3.10/site-packages/nrpc/__init__.py", line 1, in <module>
    from .lib import (
  File "/home/gwilherm/git/python-nrpc/venv/lib/python3.10/site-packages/nrpc/lib.py", line 3, in <module>
    from nats.aio.client import INBOX_PREFIX
ImportError: cannot import name 'INBOX_PREFIX' from 'nats.aio.client' (/home/gwilherm/git/python-nrpc/venv/lib/python3.10/site-packages/nats/aio/client.py)
cdevienne commented 7 months ago

Hi @gwilherm Thanks for the contrib, I merged your PR and updated the tests to pass again.