Skip to content

Commit

Permalink
Fix empty string IO (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-kuklewicz authored Dec 1, 2020
1 parent 23ebe0b commit 3a40ac8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion neptune/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,11 @@ def log_artifact(self, artifact, destination=None):
If ``None`` is passed, an artifact file name will be used.
Note:
If you provide `io.StringIO`, it will be encoded in 'utf-8' before sent to Neptune.
If you use in-memory buffers like `io.StringIO` or `io.BytesIO`, remember that in typical case when you
write to such a buffer, it's current position is set to the end of the stream, so in order to read it's
content, you need to move back it's position to the beginning.
We recommend to call seek(0) on the in-memory buffers before passing it to Neptune.
Additionally, if you provide `io.StringIO`, it will be encoded in 'utf-8' before sent to Neptune.
Raises:
`FileNotFound`: When ``artifact`` file was not found.
Expand Down
2 changes: 1 addition & 1 deletion neptune/internal/storage/datastream.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate(self, chunk_size=BYTES_IN_ONE_MB):
last_offset = new_offset
else:
if last_offset == 0:
yield FileChunk(chunk, 0, 0)
yield FileChunk(b'', 0, 0)
break

def close(self):
Expand Down

0 comments on commit 3a40ac8

Please sign in to comment.