读取从 gcs 传输的 csv 文件 2020 年 3 月 13 日时开始遇到错误。下载后检查ai平台上的文件权限
相关文档:https ://www.tensorflow.org/api_docs/python/tf/io/gfile/GFile (看起来可读属性已被删除......)
命令:
sh.gsutil('cp',GCS_PATH,raw_rating_path)
with tf.io.gfile.GFile(raw_rating_path) as f:
df = pd.read_csv(f)
已验证文件是本地文件并具有以下权限:
-rw-rw-rw- 1 root root 32617551 Apr 1 20:24 /tmp/placeScores.csv
错误(从原始 AI 平台日志中清理了一点):
File "/root/.local/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f
return _read(filepath_or_buffer, kwds)
File "/root/.local/lib/python3.7/site-packages/pandas/io/parsers.py", line 448, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File "/root/.local/lib/python3.7/site-packages/pandas/io/parsers.py", line 880, in __init__
self._make_engine(self.engine)
File "/root/.local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1114, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/root/.local/lib/python3.7/site-packages/pandas/io/parsers.py", line 1880, in __init__
src = TextIOWrapper(src, encoding=encoding, newline="")
AttributeError: 'GFile' object has no attribute 'readable'