Closed icefo closed 9 years ago
It's kind of overly specific for an example.
Also, you're not using asyncio signal handling (loop.add_signal_handler: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.add_signal_handler ) You should just be able to do loop.stop() and be good (unless you want to pop-up some sort of error message like "don't go") I also curious about this: https://gist.github.com/icefo/5cc6d3a90c2785b79f64#file-simple_wamp_backend-py-L49-L53
loop.add_signal_handler(signal.SIGINT, loop.stop)
loop.add_signal_handler(signal.SIGTERM, loop.stop)
should be sufficient.
A tutorial/example for receiving signals might be a good idea though.
On Thu, Oct 29, 2015 at 9:23 AM, icefo notifications@github.com wrote:
I was playing with your lib trying to make it work with wamp http://wamp-proto.org/ and surprisingly it worked ! It's really interesting because wamp makes message passing and RPC with a backend painless. You need a wamp router http://crossbar.io/, autobahn python http://autobahn.ws/python/ and your lib to make these examples run.
These example are intentionally a bit complex, I wanted to test everything before rewriting a medium sized PyQT5 app to use wamp. I can make them simpler if you find them interesting. simple_wamp_backend.py https://gist.github.com/icefo/5cc6d3a90c2785b79f64 gui_wamp_client.py https://gist.github.com/icefo/62b4009d3cada5539750
Here is the part that launch gui_wamp_client.py file:
if name == "main": QT_app = QApplication(sys.argv)
loop = QEventLoop(QT_app) asyncio.set_event_loop(loop) runner = ApplicationRunner(url="ws://127.0.0.1:8080/ws", realm="realm1") runner.run(MainWindow)
have a good day :-)
— Reply to this email directly or view it on GitHub https://github.com/harvimt/quamash/issues/51.
Also you should be using super() not calling init manually.
On Thu, Oct 29, 2015 at 9:55 AM, Mark Harviston infinull@gmail.com wrote:
It's kind of overly specific for an example.
Also, you're not using asyncio signal handling (loop.add_signal_handler: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.add_signal_handler ) You should just be able to do loop.stop() and be good (unless you want to pop-up some sort of error message like "don't go") I also curious about this: https://gist.github.com/icefo/5cc6d3a90c2785b79f64#file-simple_wamp_backend-py-L49-L53
loop.add_signal_handler(signal.SIGINT, loop.stop) loop.add_signal_handler(signal.SIGTERM, loop.stop)
should be sufficient.
A tutorial/example for receiving signals might be a good idea though.
On Thu, Oct 29, 2015 at 9:23 AM, icefo notifications@github.com wrote:
I was playing with your lib trying to make it work with wamp http://wamp-proto.org/ and surprisingly it worked ! It's really interesting because wamp makes message passing and RPC with a backend painless. You need a wamp router http://crossbar.io/, autobahn python http://autobahn.ws/python/ and your lib to make these examples run.
These example are intentionally a bit complex, I wanted to test everything before rewriting a medium sized PyQT5 app to use wamp. I can make them simpler if you find them interesting. simple_wamp_backend.py https://gist.github.com/icefo/5cc6d3a90c2785b79f64 gui_wamp_client.py https://gist.github.com/icefo/62b4009d3cada5539750
Here is the part that launch gui_wamp_client.py file:
if name == "main": QT_app = QApplication(sys.argv)
loop = QEventLoop(QT_app) asyncio.set_event_loop(loop) runner = ApplicationRunner(url="ws://127.0.0.1:8080/ws", realm="realm1") runner.run(MainWindow)
have a good day :-)
— Reply to this email directly or view it on GitHub https://github.com/harvimt/quamash/issues/51.
The exit_cleanup is like that because the bigger app launch process and need to wait for them to complete before exiting and without the highlighted part I get that when I press Ctrl-C:
Task was destroyed but it is pending!
task: <Task pending coro=<exit_cleanup() running at /home/adrien/Documents/PyCharm/PycharmProjects/Pc_num/wamp_tests/server.py:44> wait_for=<Future pending cb=[Task._wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<time_teller() running at /home/adrien/Documents/PyCharm/PycharmProjects/Pc_num/wamp_tests/server.py:39> wait_for=<Future pending cb=[Task._wakeup()]>>
Thank you for "loop.add_signal_handler" I didn't see it the doc. This has just solved some strange bugs I was facing. I was using super() but I stopped when I had to pass arguments. I'll read the docs about that.
I understand why you don't find these examples appropriate. Thank you for your answers and your lib :-)
I was playing with your lib trying to make it works with wamp and surprisingly it worked ! It's really interesting because wamp makes message passing and RPC with a backend painless. You need a wamp router, autobahn python and your lib to make these examples run.
These example are intentionally a bit complex, I wanted to test everything before rewriting a medium sized PyQT5 app to use wamp. I can make them simpler if you find them interesting. simple_wamp_backend.py gui_wamp_client.py
Here is the part that launch gui_wamp_client.py file:
have a good day :-)