Giter Site home page Giter Site logo

error about perlego-downloader HOT 8 CLOSED

evmer avatar evmer commented on June 15, 2024
error

from perlego-downloader.

Comments (8)

jaan143 avatar jaan143 commented on June 15, 2024 1

@evmer it is working after install wkhtmltopdf only
thank you very much

from perlego-downloader.

evmer avatar evmer commented on June 15, 2024

Hello, can you please post the book url/id so I can investigate the issue? Thank you.

from perlego-downloader.

a-sinclaire avatar a-sinclaire commented on June 15, 2024

I also ran into this same (or a similar) issue...

building pdf...
Traceback (most recent call last):
File "C:\Users\HP\Downloads\perlego-downloader-main\perlego-downloader-main\downloader.py", line 141, in <module>
    f.write(content)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2003' in position 1965: character maps to <undefined>

What I suspect is going on is when we open the file (one line earlier line 140) it is creating a file with a format which cannot support certain encoded characters.

I fixed this issue for me by altering line 140 to create the file with encoding 'utf-8'
f = open(f'epub_{BOOK_ID}/{page_no}.html', 'w', encoding='utf-8')

from perlego-downloader.

jaan143 avatar jaan143 commented on June 15, 2024

@evmer i tried same your book also this one
https://www.perlego.com/book/2173908/good-work-how-to-build-a-career-that-makes-a-difference-in-the-world-pdf

i tried both books which you showed in tutorial but getting same error

from perlego-downloader.

evmer avatar evmer commented on June 15, 2024

Thanks @a-sinclaire for the contribution. I'll run some tests and create a pull request to update the script.

@jaan143 the script cannot find the wkhtmltopdf executable, make sure you have it installed.
Also, you can give the script the full path of the executable:

path_wkhtmltopdf = "C:\Program Files(x86)\wkhtmltopdf\bin\wkhtmltopdf.exe"
config = pdfkit.configuration(wkhtmltopdf = path_wkhtmltopdf)
pdfkit.from_file([f'epub_{BOOK_ID}/{i}.html' for i in range(page_no)], f'{BOOK_ID}.pdf', options={'encoding': 'UTF-8'}, configuration = config)

from perlego-downloader.

jaan143 avatar jaan143 commented on June 15, 2024

@evmer images are missing from pdf
this one i tried
https://www.perlego.com/book/3290633/environment-and-society-a-critical-introduction-pdf

from perlego-downloader.

evmer avatar evmer commented on June 15, 2024

@jaan143 thanks for reporting this to me. Now I should have fixed the issue. Not sure if it's the perfect solution, but for now it does the job. let me know!

from perlego-downloader.

jaan143 avatar jaan143 commented on June 15, 2024

@evmer thanks dear and what about the missing chapter issue ?
https://www.perlego.com/book/2568251/english-rhythm-and-blues-where-language-and-music-come-together-pdf

from perlego-downloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.