我过去经常使用pandas和gcsfs。最近,我在尝试这样做时总是犯错误。我无法在其他系统上重现该错误。在我的系统上,我使用Python 3.9.16和Python 3.11.1都得到了错误。从下面的错误信息中可以看到,我很难在谷歌上找到答案。你有什么想法吗?
import gcsfs
import pandas as pd
x = pd.read_table("gs://MYBUCKET/clinvar/gene_specific_summary.txt")
字符串
和堆栈跟踪:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1242, in read_table
return _read(filepath_or_buffer, kwds)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 577, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1407, in __init__
self._engine = self._make_engine(f, self.engine)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1661, in _make_engine
self.handles = get_handle(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/common.py", line 716, in get_handle
ioargs = _get_filepath_or_buffer(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/pandas/io/common.py", line 414, in _get_filepath_or_buffer
file_obj = fsspec.open(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/core.py", line 134, in open
return self.__enter__()
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/core.py", line 102, in __enter__
f = self.fs.open(self.path, mode=mode)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/spec.py", line 1241, in open
f = self._open(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 1343, in _open
return GCSFile(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 1502, in __init__
super().__init__(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/spec.py", line 1597, in __init__
self.size = self.details["size"]
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 1538, in details
self._details = self.fs.info(self.path, generation=self.generation)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/asyn.py", line 121, in wrapper
return sync(self.loop, func, *args, **kwargs)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/asyn.py", line 106, in sync
raise return_result
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/fsspec/asyn.py", line 61, in _runner
result[0] = await coro
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 809, in _info
out = await self._ls(path, **kwargs)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 846, in _ls
for entry in await self._list_objects(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 545, in _list_objects
items, prefixes = await self._do_list_objects(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 580, in _do_list_objects
page = await self._call(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 430, in _call
status, headers, info, contents = await self._request(
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/decorator.py", line 221, in fun
return await caller(func, *(extras + args), **kw)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/retry.py", line 114, in retry_request
return await func(*args, **kwargs)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/core.py", line 423, in _request
validate_response(status, contents, path, args)
File "/Users/seandavis/Documents/git/infra/jupyterlab/venv/lib/python3.9/site-packages/gcsfs/retry.py", line 83, in validate_response
raise FileNotFoundError(path)
FileNotFoundError: b/MYBUCKET/o
型
1条答案
按热度按时间lx0bsm1f1#
这是一个身份验证问题。我原以为我使用的是应用程序默认凭据,但实际上,我设置了一个环境变量,该环境变量无法访问存储桶。