Repository navigation
Check for IOBase instead of BufferedIOBase - #8
wilson1yan wants to merge 1 commit into
Conversation
|
Why does it need to be IOBase? For general (unbuffered) IO objects, read() and write() may do partial work and return early, but the code on the outside currently doesn't support that. |
|
It's just that GFile internally is not a BufferedIOBase and is an IOBase. So the assert cases the code the code to always crash |
|
Same for UPath, https://pypi.org/project/universal-pathlib/ :( Any hints on what is needed to make it work? |
|
Could you try making it explicit that it's a buffered IO object? class MarkBuffered(BufferedIOBase):
def __init__(self, obj):
self.obj = obj
def __getattr__(self, name):
return getattr(self.obj, name)
obj = MarkBuffered(obj)We should find an easier solution for this since it seems to be a common catch. But just blindly accepting IOBase can lead to difficult to debug errors, if the file object is actually unbuffered. Adding an optional kwarg But let's first see if the above workaround even works. |
|
Edit: I got it to work with a more elaborate shim (but not with In my case, UPath when opened resolves into |
2767092 to
9b547e5
Compare
No description provided.