Closed frafra closed 4 years ago
Workaround:
class SmbcFileWrapper(object):
def __init__(self, obj):
self.obj = obj
def __getattr__(self, name):
return getattr(self.obj, name)
def flush(self):
pass
def tell(self):
return self.obj.seek(0, os.SEEK_CUR)
def read(self, length=0):
if length == 0:
length = self.obj.fstat()[6]-self.tell()
return self.obj.read(length)
To avoid that, I always pass a number of bytes, avoiding reading more than needed.