matheusfelipeog/worldometer

Problem with Importing and Crashing.

Electro18 opened this issue · 2 comments

worldometer.current_world_population()
Traceback (most recent call last):
File "", line 1, in
NameError: name 'worldometer' is not defined
from worldometer import Worldometer
Traceback (most recent call last):
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 234, in _get_html
self.__r.html.render(timeout=self.__timeout)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 586, in render
self.browser = self.session.browser # Automatically create a event loop and browser
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 730, in browser
self._browser = self.loop.run_until_complete(super().browser)
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 714, in browser
self._browser = await pyppeteer.launch(ignoreHTTPSErrors=not(self.verify), headless=True, args=self.__browser_args)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 307, in launch
return await Launcher(options, **kwargs).launch()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 168, in launch
self.browserWSEndpoint = get_ws_endpoint(self.url)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 227, in get_ws_endpoint
raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/init.py", line 84, in
from .api import *
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/api.py", line 108, in
__w = Worldometer()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 181, in init
self._metrics = self.collect_metrics()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 300, in collect_metrics
html = self._get_html(url=URL)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 239, in _get_html
raise Exception(err)
Exception: Browser closed unexpectedly:

This is the error

Kabewh commented

Did you find a fix to this? Thanks

Hi @Electro18 and @Kabewh,

Thank you for opening this issue, and I apologize for the delay in responding to it.

I've made a significant update to this project to address most of the recurring issues. This update introduces a new API (the old one is deprecated and will be removed in the future), new datasets, and updated documentation.

If you are still interested in this package and the collected data, you can check it out in version >=2.0.0 on PyPI.

If there are any other issues, please open them, and I will review them as soon as possible.