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

Use gmqtt without uvlo #57

Closed
simonegiacomelli opened this issue Aug 29, 2019 · 5 comments
Closed

Use gmqtt without uvlo #57

simonegiacomelli opened this issue Aug 29, 2019 · 5 comments

Comments

@simonegiacomelli
Copy link

I just installed gmqtt but uvloop does not support Windows at the moment.

Can I use gmqtt without uvloop?

In the example, there is this comment: 'gmqtt also compatibility with uvloop'
What does it mean? Is it a dependency or a choice?

best regards

@Lenka42
Copy link
Collaborator

Lenka42 commented Aug 29, 2019

Hi, @simonegiacomelli
It's just our choice. In our examples, just remove line where we set event loop policy: https://github.com/wialon/gmqtt/blob/master/examples/properties.py#L10 And everything should work.

@simonegiacomelli
Copy link
Author

Dear @Lenka42 it actually gives an exception:

Traceback (most recent call last):
File "C:/Users/Simone/Documents/beamng/precrime-tig/experiments/library-pieces/mqtt/gmqtt_example.py", line 57, in
loop.add_signal_handler(signal.SIGINT, ask_exit)
File "C:\Users\Simone\AppData\Local\Programs\Python\Python36\lib\asyncio\events.py", line 499, in add_signal_handler
raise NotImplementedError
NotImplementedError

@Lenka42
Copy link
Collaborator

Lenka42 commented Aug 29, 2019

Oh, I see. Never tried to run it on Windows actually
remove all add_signal_handler lines
And wrap loop.run_until_complete with try-except block:

try:
    loop.run_until_complete(main(host, port, token))
except KeyboardInterrupt:
    print("Received exit, exiting")

Let me know if it helps 😄

@simonegiacomelli
Copy link
Author

yes, it works! :)

Thank you very much, sir.

@simonegiacomelli
Copy link
Author

It could be beneficial for new users to have a ms windows example (with the changes discussed here).
Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants