Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

belisky
Copy link

@belisky belisky commented Jul 22, 2023

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)

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.

2 participants