tensorflow: tf.io.gfile.walk broken on Windows

It seems that the path isn’t split correctly. Filenames come with an extra \ prefix. Minimal reproducible example:

import os
import tensorflow as tf


tf.io.gfile.makedirs("ram://folder")
with tf.io.gfile.GFile("ram://folder/file.txt", mode="w") as f:
    f.write("data")

for root, _, filenames in tf.io.gfile.walk("ram://folder"):
    for filename in filenames:
        assert tf.io.gfile.exists(os.path.join(root, filename))

This passes on *nix but not on Windows. Here is a quick CI run in GitHub actions showing this: https://github.com/adriangb/tensorflow-test/actions/runs/688190284

ccing @mihaimaruseac @bhack

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 38 (35 by maintainers)

Most upvoted comments

@Venkat6871 the Colab is running under linux. This issue is about Windows.

Hi @adriangb , Can you please try with recent TF version? I tried with TF2.16.1 and I cannot reproduce the error. Please check the gist here.

Thank you!

Let’s wait to understand what the original design scope was. If ram:// works only with / but it isn’t enforced or it needs to work on native Sep by design.