dfface / xml2epub

Batch convert multiple web pages, html files or images into one e-book.
MIT License
14 stars 2 forks source link

Error 'ImageDraw' object has no attribute 'textsize' #28

Closed liar666 closed 1 year ago

liar666 commented 1 year ago

When running a simple script:

import xml2epub
book = xml2epub.Epub("AI for teachers")
chapter1 = xml2epub.create_chapter_from_file("AIforteachersxml.xml")
book.add_chapter(chapter1)
book.create_epub("./")

I get this error:

Traceback (most recent call last):
  File "/home/guillaume.muller/tmp/EBook/converter.py", line 8, in <module>
    book.create_epub("./")
  File "/home/guillaume.muller/tmp/EBook/lib/python3.10/site-packages/xml2epub/epub.py", line 410, in create_epub
    create_cover()
  File "/home/guillaume.muller/tmp/EBook/lib/python3.10/site-packages/xml2epub/epub.py", line 370, in create_cover
    cover = get_cover_image(title=self.title, author=self.creator, publisher=self.publisher)
  File "/home/guillaume.muller/tmp/EBook/lib/python3.10/site-packages/xml2epub/cover.py", line 41, in get_cover_image
    author_text_size = d.textsize(text=author, font=author_font)
AttributeError: 'ImageDraw' object has no attribute 'textsize'
dfface commented 1 year ago

Hello, this is caused by installing the latest version of pillow 10.0.

We just restricted the version of the pillow library to 9.5, and released the latest v2.6.3 version, you can now upgrade. By the way, our library supports Python 3.7~3.11, but not 3.12.