Skip to content

Conversation

@nfiawornu
Copy link

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

@eriktrom
Copy link

+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)

@weshowe
Copy link

weshowe commented Nov 9, 2024

This is apparently caused by having a version of Python that's too new (3.10 for me as well). Also resolved by updating BS4. I forked this repo so I could add that change and some other stuff, patience was never my strong suit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants