I keep getting the following warning when using tfio.experimental.image.decode_tiff. I find that it works fine but keeps giving these warnings, which I want to suppress.
TIFFFetchNormalTag: Warning, ASCII value for tag "DateTime" contains null byte in value; value incorrectly truncated during reading due to implementation limitations.
I am using it as follows:
string = tf.io.read_file(filename)
image = tfio.experimental.image.decode_tiff(string) # this line produces warning
If I try to suppress the warning using warning
, it doesn't seem to work? It doesn't give me an error, but it doesn't do anything.
import warnings
warnings.filterwarnings('ignore', message='ASCII value for tag "DateTime" contains null byte in value; value incorrectly truncated during reading due to implementation limitations')
How can I suppress this warning, or alternatively address the issue that produces the warning?
If you want to supress all warning then you can use
warnings.filterwarnings("ignore")
If want to supress some mesage then you have to use message=...
with beginning of message or with .*
at the beginning
warnings.filterwarnings("ignore", message=".*ASCII value for tag")
Minimal example:
import warnings
warnings.filterwarnings("ignore", message=".*ASCII value for tag")
# some tests - it should be supressed by `filterwarnings()`
warnings.warn('TIFFFetchNormalTag: Warning, ASCII value for tag "DateTime" contains null byte in value; value incorrectly truncated during reading due to implementation limitations.')
print("Hello World")