We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a405326 commit c56bf6bCopy full SHA for c56bf6b
kaitaistruct.py
@@ -300,7 +300,9 @@ def read_bytes(self, n):
300
)
301
302
is_satisfiable = True
303
- if self._io.seekable():
+ # in Python 2, there is a common error ['file' object has no
304
+ # attribute 'seekable'], so we need to make sure that seekable() exists
305
+ if callable(getattr(self._io, 'seekable', None)) and self._io.seekable():
306
num_bytes_available = self.size() - self.pos()
307
is_satisfiable = (n <= num_bytes_available)
308
0 commit comments