Passing jpegs constructed from byte streams crashes with FileNotFoundError: [Errno 2] No such file or directory: ''
#415
Labels
bug
Something isn't working
Environment
I don't believe this bug is environment dependent
To reproduce
This line of code: https://github.com/mosaicml/streaming/blob/v0.5.2/streaming/base/format/mds/encodings.py#L417
assumes that
Image
s created from byte-streams will havehasattr(obj, 'filename') == False
, however I believe they will actually haveobj.filename == ''
. This will then throw an exception onwith open(obj.filename, 'rb') as f
, since thefilename
is empty-string.Here's a minimal script you can use to prove this:
You can see it has the
filename
attribute, and printing it is empty string. I imagine the fix is just to check if the filename is empty string?Expected behavior
Additional context
The text was updated successfully, but these errors were encountered: