Get_image_files(path) returning empty list v2

I keep getting an empty list on the Grizzly Bear project, despite tweaking my code to take into account this prior thread on the subject. Does anyone know what I might be doing wrong?

bear_types = 'grizzly','black','teddy'
path = Path('bears')

if not path.exists():
    path.mkdir()
    for o in bear_types:
        dest = (path/o)
        dest.mkdir(exist_ok=True)
        results = search_images_ddg(f'{o} bear')
        download_images(dest, urls=results.attrgot('contentUrl'))

fns = get_image_files(path)
fns

This returns: (#0) []

Thank you for any guidance

3 Likes

Have you verified which lines of your code are actually being executed? Its about time I learnt to use the python debugger in jupyter, but in the meantime you can do it the older fashioned way…

if not path.exists():
    print("GOT HERE")
    path.mkdir()
    for o in bear_types:
        print("PROCESSING: ", o)
...etc
1 Like

had the same problem (using Colab to run) this seemed to work
Screenshot from 2022-09-16 12-08-47

if you are still looking for something on this, here is a starting point (radek’s tweet)-

this ^ is helpful after you get an exception to poke around
But if you want to step through your code checkout %%debug :slight_smile: