I have found a problem that is, I can't import worldometer to notebooks.
Env: anaconda3, WSL
Version: Python 3.8.3, worldometer-1.0.1
The full error response is:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in _get_html(self, url)
233 self.__r = session.get(url, timeout=self.__timeout)
--> 234 self.__r.html.render(timeout=self.__timeout)
235
~/anaconda3/lib/python3.8/site-packages/requests_html.py in render(self, retries, script, wait, scrolldown, sleep, reload, timeout, keep_page)
585
--> 586 self.browser = self.session.browser # Automatically create a event loop and browser
587 content = None
~/anaconda3/lib/python3.8/site-packages/requests_html.py in browser(self)
728 if self.loop.is_running():
--> 729 raise RuntimeError("Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.")
730 self._browser = self.loop.run_until_complete(super().browser)
RuntimeError: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-3-c4b22f2d5ddf> in <module>
----> 1 import worldometer
~/anaconda3/lib/python3.8/site-packages/worldometer/__init__.py in <module>
82
83 from .core import Worldometer
---> 84 from .api import *
~/anaconda3/lib/python3.8/site-packages/worldometer/api.py in <module>
106
107
--> 108 __w = Worldometer()
109
110
~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in __init__(self, timeout)
179 self.__timeout = timeout
180
--> 181 self._metrics = self.collect_metrics()
182
183 def __str__(self):
~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in collect_metrics(self)
298
299 if self.__r is None:
--> 300 html = self._get_html(url=URL)
301 else:
302 html = self.__r.html.raw_html
~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in _get_html(self, url)
237
238 except Exception as err:
--> 239 raise Exception(err)
240
241 @staticmethod
Exception: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.
I thinks this is one of a limitation of WSL hence hope anyone find out the solution soon.
I have found a problem that is, I can't import
worldometerto notebooks.Env:
anaconda3,WSLVersion:
Python 3.8.3,worldometer-1.0.1The full error response is:
I thinks this is one of a limitation of
WSLhence hope anyone find out the solution soon.