-
Notifications
You must be signed in to change notification settings - Fork 732
Open
Description
🐛 Describe the bug
In the tutorial for StreamWriter, it is clearly stated that StreamWriter works with File-like object that implements io.RawIOBase.write. However, when I used StreamWriter with the Google Cloud Storage BlobWriter object that implements write but not seek, an error is thrown on calling StreamWriter.close():
from google.cloud.storage import Blob
from torch.io import StreamWriter
blob = Blob(name=..., bucket=...)
with blob.open("wb") as f:
writer = StreamWriter(dst=f)
with writer.open():
...self = <torio.io._streaming_media_encoder.StreamingMediaEncoder object at 0x110096190>
def close(self):
"""Close the output
:py:class:`StreamingMediaEncoder` is also a context manager and therefore supports the
``with`` statement.
It is recommended to use context manager, as the file is closed automatically
when exiting from ``with`` clause.
See :py:meth:`StreamingMediaEncoder.open` for more detail.
"""
if self._is_open:
> self._s.close()
E io.UnsupportedOperation: seek
.venv/lib/python3.11/site-packages/torio/io/_streaming_media_encoder.py:451: UnsupportedOperation
Clearly seek is called in close(), which causes this error. For now, can I get around this issue by not calling close on the writer object but do call close the blob object?
Versions
google-cloud-storage 3.1.0
torchaudio 2.6.0
Metadata
Metadata
Assignees
Labels
No labels