-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial read on nonexistent tf.gfile.GFile in w+ mode crashes #32090
Comments
|
I expect that the Since this isn't the case it breaks things like Workarounds are to either write something, e.g. |
This happens on both nightly and 2.0. As I'm working on modularizing filesystem support, I'm assigning this to me, although it will take a while until I can get to the python side of things. In the end, the expected behavior should be similar to Python's: >>> with open('this_file_does_not_exist_at_all', 'w+') as f: f.read()
...
'' |
Related to the fact that GFile does not truncate files the same way as Python, reading an existing file opened with Example:
|
I'll have to handle that too, thanks for pointing it out |
|
Any update on this? I'm running into this error trying to write to s3 with gfile and pysoundfile |
@mihaimaruseac Any updates on this? This still seems to be an issue with TF 2.5 and prevent's the use of |
issue still exists in |
Problem is the modularization effort stalled since members left the team last year. We onboarded new members recently, so we should pick up these items again. Apologies for the delays. |
from @eirism in #32090 (comment):
could you give an example of such a workaround? I tried the following unsuccessful: import numpy as np
import tensorflow as tf
with tf.io.gfile.GFile("output.npz", "w") as file:
file.write("")
np.savez(file, content=np.array([1, 2, 3])) Still getting
|
@patzm Since |
sadly also doesn't work for me. Neither |
a similar approach that works for me.
|
Writing to a buffer to avoid read error in np.savez when using GFile. See: tensorflow/tensorflow#32090
I was able to replicate the issue in tf-nightly 2.12.0-dev20221215. Please find the gist for reference. Thank you. |
Writing to a buffer to avoid read error in np.savez when using GFile. See: tensorflow/tensorflow#32090
System information
Describe the current behavior
Python raises
tensorflow.python.framework.errors_impl.NotFoundError
when doing a first read (no writes before it) on a nonexistenttf.gfile.GFile
inw+
mode.Describe the expected behavior
Read on an empty
w+
file should return an empty string.One problem with the current behaviour is that numpy.savez() crashes when writing to a GFile.
Code to reproduce the issue
Other info / logs
The text was updated successfully, but these errors were encountered: