Skip to content

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