alfred82santa / whalesong

Whalesong is an asyncio python library to manage WebApps remotely. Currently WhatsappWeb is implemented
https://whalesong.readthedocs.io
MIT License
50 stars 19 forks source link

RuntimeError in whai_until_stop #91

Closed parthibd closed 5 years ago

parthibd commented 5 years ago

This piece of code in your minibot.py gives me an runtime error .


    async def start(self):
        await self._driver.start()

        ensure_future(self.monitor_stream())

        await self._driver.wait_until_stop()

if __name__ == '__main__':
    bot = Minibot()
    bot.loop.run_until_complete(bot.start())

pydev debugger: process 7660 is connecting

Connected to pydev debugger (build 182.5107.22)
Traceback (most recent call last):
Monitor stream
  File "C:\Program Files\JetBrains\PyCharm 2018.2.5\helpers\pydev\pydevd.py", line 1664, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm 2018.2.5\helpers\pydev\pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm 2018.2.5\helpers\pydev\pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2018.2.5\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Parthib/PycharmProjects/whatsapp-api/script.py", line 233, in <module>
    bot.loop.run_until_complete(bot.start())
  File "C:\Users\Parthib\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 584, in run_until_complete
    return future.result()
  File "C:/Users/Parthib/PycharmProjects/whatsapp-api/script.py", line 228, in start
    await self._driver.wait_until_stop()
  File "C:\Users\Parthib\AppData\Local\Programs\Python\Python37-32\lib\site-packages\whalesong\__init__.py", line 108, in wait_until_stop
    await self._driver.whai_until_stop()
  File "C:\Users\Parthib\AppData\Local\Programs\Python\Python37-32\lib\site-packages\whalesong\driver.py", line 177, in whai_until_stop
    raise RuntimeError('Driver not started')
RuntimeError: Driver not started

    async def whai_until_stop(self):
        if self._fut_stop is None:
            raise RuntimeError('Driver not started')

        await self._fut_stop

apparently self._fut_stop is set to None in start driver .

alfred82santa commented 5 years ago

I think we could remove this function... It is not necessary now. You could use stop() method directly with same functionality.

parthibd commented 5 years ago

Instead of removing it what do you suggest to fix it?