Skip to content

allow loading content through byte streams.#299

Open
daoyeppl wants to merge 4 commits into
aerkalov:masterfrom
daoyeppl:master
Open

allow loading content through byte streams.#299
daoyeppl wants to merge 4 commits into
aerkalov:masterfrom
daoyeppl:master

Conversation

@daoyeppl

Copy link
Copy Markdown

No description provided.

Comment thread ebooklib/epub.py Outdated

def _load(self):
if os.path.isdir(self.file_name):
if isinstance(self.file_name, str) and os.path.isdir(self.file_name):

@dnesting dnesting Feb 18, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just a bystander, and I'm not sure what kind of Python version compatibility this is striving for, but in more recent versions of Python, this might be more accurate:

if isinstance(self.file_name, (str, bytes, os.PathLike))

Either way this patch is what I came here to find, so thank you.

@c1924959470

c1924959470 commented Feb 18, 2024 via email

Copy link
Copy Markdown

daoyeppl added 3 commits July 25, 2025 15:00
If filename is not str or PathLike, do not use isdir detection and directly use ZipFile to read.
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