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

allow loading content through byte streams. #299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ebooklib/epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ def _load_opf_file(self):
)

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

@dnesting dnesting Feb 18, 2024

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.

file_name = self.file_name

class Directory:
Expand Down