Skip to content

Fix seek throwing UnsupportedOperationException #80

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

Closed

Conversation

ulikoehler
Copy link
Contributor

There are some file-like object implementation, most notably in the Python standard library (zipfile.ZipExtFile), where hasattr(filelike, "seek") returns True but calling seek() raises UnsupportedOperationException.

This PR fixes this by catching UnsupportedOperationException, in effect handling it as if hasattr(filelike, "seek") returns False.

If required, I can provide a full example showing the issue (i.e. reading directly from a ZIP without unzipping, which I'm currently writing a blogpost about).

@ulikoehler
Copy link
Contributor Author

Sorry, there seem to be more issues with files not supporting seek than just opening them at the moment. This doesn't seem to be covered by the unit tests. I'll have to do some more investigation before I can submit a pull request.

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.

1 participant