-
Notifications
You must be signed in to change notification settings - Fork 64
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
is_dir() and is_file() are not working properly for gs #493
Comments
This doesn't repro generically, so it has something to do with the configuration of your bucket/storage and the objects that actually exist in your storage. For example, I see: In [1]: from cloudpathlib import CloudPath
In [2]: CloudPath('gs://cloudpathlib-test-bucket/performance_tests/').is_dir()
Out[2]: True
In [2]: CloudPath('gs://cloudpathlib-test-bucket/performance_tests').is_dir()
Out[2]: True Do you have more information about your use case? A few helpful questions:
|
Quick update: I tried creating a path with gsutil: |
Hey @pjbull, any updates on this? 😅 |
I similarly created a folder via the gui on a
returns
this seems to me like GUI generated folders are considered as file objects (but not really? since this object can have children) I also performed:
and even after that operation the folder seems to persist in gcs for some weird reason, whereas non gui created folders automatically gets deleted if all children blobs are removed. On why so potentially a fix is just to embed a check inside the
something like that could potentially work? happy to submit something if this solution is acceptable |
Hi @shanirosen-airis, @fafnirZ, Unfortunately, this is a tricky gotcha that we haven't totally figured out the right UX for. It is indeed the case that when you create a folder in the web console GUI, there is a fake file that gets created with the folder's name. This is because object stores generally have a "flat" address space. Unlike the file system on your computer, they don't have the concept of a folder at all. This is true not just of GCS, but also Amazon S3 and Azure Blob Storage. When you have an object The natural question is then: what is the console GUI doing? The web consoles for these services parse the paths and split on the Then, why the behavior when you use the "Create folder" action? The only way for the console GUI to know to show you a folder at So, at a basic level, cloudpathlib is doing the correct naive thing because it detects there is a file in your bucket named |
See also #51 for discussion about this and why this is not straightforward. |
Hey,
I tried to use the
is_dir
andis_file
functions from both s3 and gs, but discovered that:looks like in gs everything is classified as a file unless I strip the last "/".
Any Idea why is this happening?
using
cloudpathlib==0.20.0
Thanks in advance
The text was updated successfully, but these errors were encountered: