Skip to content
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

Trio example not working with latest trio version #678

Closed
adiroiban opened this issue Sep 16, 2022 · 1 comment · Fixed by #679
Closed

Trio example not working with latest trio version #678

adiroiban opened this issue Sep 16, 2022 · 1 comment · Fixed by #679
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@adiroiban
Copy link
Contributor

Hi,

I am trying to run paho with trio.

I am completely new to paho or trio.

I got a copy paste of the example.

I am using:

  • Python 3.10.4 - Ubuntu 22.04
  • trio (0.21.0)
  • paho (1.6.1)

The traceback

python run-trio.py 
Starting
Socket opened
large write request
misc_loop started
Traceback (most recent call last):
  File "/home/adi/chevah/run-trio.py", line 139, in <module>
    trio.run(TrioAsyncMqttExample().main)
  File "/home/adi/chevah/venv/lib/python3.10/site-packages/trio/_core/_run.py", line 1946, in run
    raise runner.main_task_outcome.error
  File "/home/adi/chevah/run-trio.py", line 129, in main
    async with trio.open_nursery() as nursery:
  File "/home/adi/chevah/venv/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
    raise combined_error_from_nursery
  File "/home/adi/chevah/run-trio.py", line 70, in read_loop
    await trio.hazmat.wait_readable(self.sock)
  File "/home/adi/chevah/venv/lib/python3.10/site-packages/trio/_deprecate.py", line 124, in __getattr__
    raise AttributeError(msg.format(self.__name__, name))
AttributeError: module 'trio' has no attribute 'hazmat'
finished large write

It looks like the hazmat was deprecated python-trio/trio#1722

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Sep 16, 2022
@adiroiban
Copy link
Contributor Author

adiroiban commented Sep 16, 2022

I think the fix is something like this

-await trio.hazmat.wait_readable(self.sock)
+await trio.lowlevel.wait_readable(self.sock)

I tried it and it looks like it's working, I will open a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant