question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

* not working in glob

See original GitHub issue

glob raises an exception when I try to use a simple asterisk on the latest version :

In [5]: storage.glob(‘bucketx/a’) Out[5]: [‘bucketx/a/b’]

In [6]: storage.walk(‘bucketx/’) Out[6]: [‘bucketx/a/b/c/d/sh’]

In [7]: storage.glob(‘bucketx/*/b’)

ClientError Traceback (most recent call last) … ~/.virtualenvs/cassie-backup/lib/python3.6/site-packages/s3fs/core.py in info(self, path, **kwargs) 411 except (ClientError, ParamValidationError) as e: 412 logger.debug(“Failed to head path %s”, path, exc_info=True) –> 413 raise FileNotFoundError(path) 414 415 _metadata_cache = {}

FileNotFoundError: bucketx/*/b

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
martindurantcommented, Apr 26, 2018

Would you like to have a go? I recommend by starting with S3FileSystem._walk, adding an optional parameter dictionaries=False, and changing the last line of the function appropriately. The same parameter should then appear in walk, and so when glob calls it, you get both files and directories.

0reactions
cscetboncommented, Apr 26, 2018

I see no blocker to implement it. If we want to work with s3 as we do with files and directories it makes sense to me. I need to find paths that contain a certain folder without having to know exactly what’s stored in deeper levels. A workaround would be to use walk and then apply a regex on it what is done internally, something which can be done with the regular glob.glob.

I don’t think it would be hard to implement. We could also limit the walk when the end of the pattern is reached (avoiding to walk through deeper level when we’re only interested in folders)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python glob.glob always returns empty list - Stack Overflow
I faced a lot of problem in globbing on ubuntu. This code works fine on windows cv_img = [] for img in glob.glob('/home/itisha/Desktop/op/*....
Read more >
glob.glob not working... : r/learnpython - Reddit
glob.glob not working... import glob c = glob.glob("*.txt") for file in c: print(file). This isn't printing anything, I don't know why.
Read more >
glob.glob and gdal_translate not working - GIS Stack Exchange
The big issue was that it appears that you're trying to set your input and output filenames to a wildcard (the *.tif). Additionally...
Read more >
glob — Unix style pathname pattern expansion ... - Python Docs
Source code: Lib/glob.py The glob module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell, ......
Read more >
glob not finding expected directory #15154 - bazelbuild/bazel
Description of the problem / feature request: I swear glob is haunted. It can find a sibling dir, but not an adjacent sibling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found