evmer / perlego-downloader

Download books from Perlego.com in PDF format
MIT License
106 stars 52 forks source link

File "f:\downloader.py", line 250, in <module> asyncio.run(html2pdf()) #62

Closed ctechid closed 1 year ago

ctechid commented 1 year ago

I got error as follows. How to resolved this problem? I use Python 3.11

C:\Python311>python f:\downloader.py
chapters 0-1 downloaded
chapters 1-3 downloaded
chapters 3-4 downloaded
chapters 4-5 downloaded
chapters 5-6 downloaded
chapters 6-7 downloaded
chapters 7-8 downloaded
chapters 8-9 downloaded
chapters 9-10 downloaded
chapters 10-11 downloaded
chapters 11-12 downloaded
chapters 12-13 downloaded
chapters 13-14 downloaded
chapters 14-15 downloaded
chapters 15-16 downloaded
chapters 16-17 downloaded
chapters 17-18 downloaded
chapters 18-19 downloaded
chapters 19-20 downloaded
chapters 20-21 downloaded
chapters 21-23 downloaded
chapters 22-23 downloaded
Traceback (most recent call last):
  File "f:\downloader.py", line 250, in <module>
    asyncio.run(html2pdf())
  File "C:\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "f:\downloader.py", line 171, in html2pdf
    browser = await launch(options={
              ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyppeteer\launcher.py", line 307, in launch
    return await Launcher(options, **kwargs).launch()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyppeteer\launcher.py", line 168, in launch
    self.browserWSEndpoint = get_ws_endpoint(self.url)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyppeteer\launcher.py", line 227, in get_ws_endpoint
    raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:
ctechid commented 1 year ago

I resolved problem with add follows code

browser = await launch(options={
            'headless': True,
            'autoClose': False,         
                        `'executablePath': 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',

in downloader.py