evmer / perlego-downloader

Download books from Perlego.com in PDF format
MIT License
117 stars 54 forks source link

Cannot download the PDF with PIL and AttributeError: module 'asyncio' has no attribute 'run' #65

Open Jhaultch opened 1 year ago

Jhaultch commented 1 year ago

when I run the "python3 downloader.py" it stopped as under error: Traceback (most recent call last): File "downloader.py", line 2, in from PIL import Image ModuleNotFoundError: No module named 'PIL'

After I commented line 2, coutinue run "python3 downloader.py",it began to download the pdf by pages, when finished the downloading process,it shows as below: Traceback (most recent call last): File "downloader.py", line 250, in asyncio.run(html2pdf()) AttributeError: module 'asyncio' has no attribute 'run'

who could help me .thanks a lot.

romantci2710 commented 1 year ago

ModuleNotFoundError: No module named 'PIL' This error message indicates that the Python interpreter cannot find the PIL (Python Imaging Library) module that is required for the code to run.

To resolve this issue, you need to install the PIL module in your Python environment. You can do this by running the following command in your terminal or command prompt:

Copy code pip install pillow This command will install the Pillow library, which is a fork of the PIL library that supports more image file formats and is actively maintained.

After installing the Pillow library, try running your code again. It should now be able to find and import the PIL module without any issues. p/s: ChatGPT suggested and I have solved the same issue by this way. please note that you should solve the issue not just "comment" the code to pass

Jhaultch commented 1 year ago

ModuleNotFoundError: No module named 'PIL' This error message indicates that the Python interpreter cannot find the PIL (Python Imaging Library) module that is required for the code to run.

To resolve this issue, you need to install the PIL module in your Python environment. You can do this by running the following command in your terminal or command prompt:

Copy code pip install pillow This command will install the Pillow library, which is a fork of the PIL library that supports more image file formats and is actively maintained.

After installing the Pillow library, try running your code again. It should now be able to find and import the PIL module without any issues. p/s: ChatGPT suggested and I have solved the same issue by this way. please note that you should solve the issue not just "comment" the code to pass

Really thank you for you reply, this repository is minority repository, I did not expect has such quickly reply, you are right I should not solve the issue by "comment" the code to pass. I reinstall the Pillow library by blow commands:

python3 -m pip install --upgrade pip python3 -m pip install --upgrade Pillow

after that the PIL error didn`t show again,but another info shows after I run "python3 downloader.py" {'event': 'error', 'data': {'message': 'An unexpected error occurred.', 'code': 18}} I really don`t know what`s happening. Does it means the line of code 18:AUTH_TOKEN is not right ? I really confused...