equinor/xtgeo

Check folder function raises ValueError if file object is a memory stream

Closed this issue · 0 comments

Currently in FIleWrapper class:

    if self.memstream or isinstance(self.file, (io.BytesIO, io.StringIO)):
            raise ValueError("Cannot check folder status of an in-memory file")

and in code using memory stream, we have e.g.

    if not _gfile.memstream:
            _gfile.check_folder(raiseerror=OSError)


A better pattern will be to let the check always return True if memstream, and rather remove the if not _gfile.memstream condition.

This issue was triggered in #1251