EpubToPdf icon indicating copy to clipboard operation
EpubToPdf copied to clipboard

fix: fixes collections module import in getpy.py for python3.10

Open belisky opened this issue 2 years ago • 1 comments

I was getting a collections.Callable error when I first run the project. This was how I was able to fix that error.

belisky avatar Jul 22 '23 23:07 belisky

+1 for merging this.

Error without the merge:

--- Epub to PDF conversion started
Traceback (most recent call last):
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/main.py", line 39, in <module>
    process()
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/main.py", line 18, in process
    engine.get_all()
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/getpy.py", line 80, in get_all
    xml_tree = bs(xml_content, features = "xml")
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/.env/lib/python3.10/site-packages/bs4/__init__.py", line 228, in __init__
    self._feed()
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/.env/lib/python3.10/site-packages/bs4/__init__.py", line 289, in _feed
    self.builder.feed(self.markup)
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/.env/lib/python3.10/site-packages/bs4/builder/_lxml.py", line 131, in feed
    self.parser = self.parser_for(self.soup.original_encoding)
  File "/home/parallels/devlocal/dev-oss/EpubToPdf/.env/lib/python3.10/site-packages/bs4/builder/_lxml.py", line 61, in parser_for
    if isinstance(parser, collections.Callable):
AttributeError: module 'collections' has no attribute 'Callable'

Non Error output after merging this PR:

--- Epub to PDF conversion started
--- Sections converted to pdf
--- Sections combined together in a single pdf file
--- Individual pdf files deleted from directory
--- Epub to PDF conversion successful

Note I did not test this on anything but Python 3.10.12 install via sudo apt install python3 on Ubuntu 22.04.4 LTS (GNU/Linux 6.5.0-41-generic x86_64)

eriktrom avatar Jun 20 '24 23:06 eriktrom