Skip to content
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

epath behaves weird using fsspec on gcs #508

Open
hmeyer opened this issue Dec 13, 2023 · 2 comments
Open

epath behaves weird using fsspec on gcs #508

hmeyer opened this issue Dec 13, 2023 · 2 comments

Comments

@hmeyer
Copy link
Contributor

hmeyer commented Dec 13, 2023

Via GCloud Console I clicked "CREATE FOLDER" to create empty_folder.
Then I did:

$ touch /tmp/test.txt
$ gsutil cp /tmp/test.txt gs://henning-test/folder/test.txt

$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from etils import epath
>>> epath.gpath._is_tf_installed()
False
>>> e = epath.Path('gs://henning-test/empty_folder')
>>> f'{e.exists()=} {e.is_dir()=}'
'e.exists()=True e.is_dir()=False'
>>> list(e.iterdir())
[PosixGPath('gs://henning-test/empty_folder')]

>>> f = epath.Path('gs://henning-test/folder')
>>> f'{f.exists()=} {f.is_dir()=}'
'f.exists()=True f.is_dir()=False'

>>> t = epath.Path('gs://henning-test/folder/test.txt')
>>> f'{t.exists()=} {t.is_dir()=}'
't.exists()=True t.is_dir()=False'
>>> list(t.iterdir())
[PosixGPath('gs://henning-test/folder/test.txt/test.txt')]
@Conchylicultor
Copy link
Member

Conchylicultor commented Dec 13, 2023

p.is_dir() directly call fs.isdir():

return self.fs(path).isdir(path)

So I think this is a fsspec bug. You can check with:

import fsspec  # pylint: disable=g-import-not-at-top

fs = fsspec.filesystem('gcs')

print(fs.isdir('gs://henning-test/folder'))

Might be related to: fsspec/gcsfs#574

@hmeyer
Copy link
Contributor Author

hmeyer commented Dec 13, 2023

Good point. Added fsspec/gcsfs#574 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants