flickr_scraper icon indicating copy to clipboard operation
flickr_scraper copied to clipboard

Script won't pull photos

Open Fahrenheit opened this issue 4 years ago • 11 comments

I attempted to use the command suggested and have tried to pull other things however I always get this error. It creates the necessary folders, but won't grab any of the photos. Not quite sure how to fix this. Any help would be much appreciated!

`flickr_scraper` % python3 flickr_scraper.py --search 'honeybees' --n 10 --download           
Traceback (most recent call last):
  File "/Users/fah/Projects/flickr_scraper/flickr_scraper.py", line 62, in <module>
    get_urls(search=opt.search,  # search term
  File "/Users/fah/Projects/flickr_scraper/flickr_scraper.py", line 31, in get_urls
    for i, photo in enumerate(photos):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flickrapi/core.py", line 690, in data_walker
    photoset = rsp.getchildren()[0]
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

Fahrenheit avatar Jan 16 '21 19:01 Fahrenheit

@Fahrenheit script works correctly, just tested it today 16 January 2021 in a Colab notebook.

Screen Shot 2021-01-16 at 9 22 00 PM

glenn-jocher avatar Jan 17 '21 05:01 glenn-jocher

@Fahrenheit script works correctly, just tested it today 16 January 2021 in a Colab notebook.

Screen Shot 2021-01-16 at 9 22 00 PM

Odd, I still can't get it to work.

Fahrenheit avatar Jan 17 '21 19:01 Fahrenheit

@Fahrenheit are you using the Flickr API key and secret as in the README instructions? https://github.com/ultralytics/flickr_scraper#use

glenn-jocher avatar Jan 17 '21 20:01 glenn-jocher

@Fahrenheit are you using the Flickr API key and secret as in the README instructions? https://github.com/ultralytics/flickr_scraper#use

Yes, I am. I'll try a new API key and see if that works.

Fahrenheit avatar Jan 17 '21 20:01 Fahrenheit

I think this might be related to the deprecation of getchildren in Python 3.9. See https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren.

guillaumedavidphd avatar Jan 31 '21 01:01 guillaumedavidphd

@guillaumedavidphd thanks for the info! We don't use this in ultralytics/flickr_scraper but I see it is used in the flickrapi package.

@Fahrenheit perhaps downgrading your python to 3.8 might solve this?

glenn-jocher avatar Jan 31 '21 02:01 glenn-jocher

Thanks this worked !!

gpotte avatar Feb 05 '21 11:02 gpotte

Hi i did help with someone with this error on python-forum.io
First show how to run Python 3.8 in environment with py(no need to downgrade)

# Make environment with Python 3.8 
G:\div_code\py -3.8 -m venv flick38_env  

Then i looked at error.
In core.py line 690.

#photoset = rsp.getchildren()[0]  
photoset = list(rsp)[0] # Fix for Python 3.9

Test with Python 3.9

(flick_env) G:\div_code\flick_env\flickr_scraper (master)
λ python flickr_scraper.py --search "bees" --n 10 --download
0/10 https://live.staticflickr.com/5537/14142817779_8786627929_o.jpg
1/10 https://live.staticflickr.com/829/41747732682_f4f10ec204_o.jpg
2/10 https://live.staticflickr.com/1662/23809746334_c22950a054_o.jpg
3/10 https://live.staticflickr.com/4094/4822128168_415b5ce1e4_o.jpg
4/10 https://farm6.staticflickr.com/5511/12638717365_7643b6e19a_b.jpg
5/10 https://live.staticflickr.com/961/27921370568_0795b91dfb_o.jpg
6/10 https://farm2.staticflickr.com/1646/26540040015_54f071db32_b.jpg
7/10 https://farm8.staticflickr.com/7377/26868463353_6da2da165d_b.jpg
8/10 https://farm8.staticflickr.com/7595/17187249975_b1ccddea5f_b.jpg
9/10 https://farm2.staticflickr.com/1578/26186589965_678bd3c5a4_b.jpg

snippsat avatar Jun 25 '21 15:06 snippsat

Hi i did help with someone with this error on python-forum.io First show how to run Python 3.8 in environment with py(no need to downgrade)

# Make environment with Python 3.8 
G:\div_code\py -3.8 -m venv flick38_env  

Then i looked at error. In core.py line 690.

#photoset = rsp.getchildren()[0]  
photoset = list(rsp)[0] # Fix for Python 3.9

Test with Python 3.9

(flick_env) G:\div_code\flick_env\flickr_scraper (master)
λ python flickr_scraper.py --search "bees" --n 10 --download
0/10 https://live.staticflickr.com/5537/14142817779_8786627929_o.jpg
1/10 https://live.staticflickr.com/829/41747732682_f4f10ec204_o.jpg
2/10 https://live.staticflickr.com/1662/23809746334_c22950a054_o.jpg
3/10 https://live.staticflickr.com/4094/4822128168_415b5ce1e4_o.jpg
4/10 https://farm6.staticflickr.com/5511/12638717365_7643b6e19a_b.jpg
5/10 https://live.staticflickr.com/961/27921370568_0795b91dfb_o.jpg
6/10 https://farm2.staticflickr.com/1646/26540040015_54f071db32_b.jpg
7/10 https://farm8.staticflickr.com/7377/26868463353_6da2da165d_b.jpg
8/10 https://farm8.staticflickr.com/7595/17187249975_b1ccddea5f_b.jpg
9/10 https://farm2.staticflickr.com/1578/26186589965_678bd3c5a4_b.jpg

thank you.. you saved me

beautytasara27 avatar Oct 14 '21 03:10 beautytasara27

Hi i did help with someone with this error on python-forum.io First show how to run Python 3.8 in environment with py(no need to downgrade)

# Make environment with Python 3.8 
G:\div_code\py -3.8 -m venv flick38_env  

Then i looked at error. In core.py line 690.

#photoset = rsp.getchildren()[0]  
photoset = list(rsp)[0] # Fix for Python 3.9

Test with Python 3.9

(flick_env) G:\div_code\flick_env\flickr_scraper (master)
λ python flickr_scraper.py --search "bees" --n 10 --download
0/10 https://live.staticflickr.com/5537/14142817779_8786627929_o.jpg
1/10 https://live.staticflickr.com/829/41747732682_f4f10ec204_o.jpg
2/10 https://live.staticflickr.com/1662/23809746334_c22950a054_o.jpg
3/10 https://live.staticflickr.com/4094/4822128168_415b5ce1e4_o.jpg
4/10 https://farm6.staticflickr.com/5511/12638717365_7643b6e19a_b.jpg
5/10 https://live.staticflickr.com/961/27921370568_0795b91dfb_o.jpg
6/10 https://farm2.staticflickr.com/1646/26540040015_54f071db32_b.jpg
7/10 https://farm8.staticflickr.com/7377/26868463353_6da2da165d_b.jpg
8/10 https://farm8.staticflickr.com/7595/17187249975_b1ccddea5f_b.jpg
9/10 https://farm2.staticflickr.com/1578/26186589965_678bd3c5a4_b.jpg

thank you.. you saved me

worked for me ,thanks

yx135790 avatar Feb 16 '22 02:02 yx135790

@beautytasara27 you save me, thank you so much.

sinhakrishnendu avatar May 03 '22 06:05 sinhakrishnendu