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

Script won't pull photos #5

Open
Fahrenheit opened this issue Jan 16, 2021 · 11 comments
Open

Script won't pull photos #5

Fahrenheit opened this issue Jan 16, 2021 · 11 comments

Comments

@Fahrenheit
Copy link

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'
@glenn-jocher
Copy link
Member

@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

@Fahrenheit
Copy link
Author

@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.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 17, 2021

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

@Fahrenheit
Copy link
Author

@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.

@guillaumedavidphd
Copy link

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.

@glenn-jocher
Copy link
Member

@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?

@gpotte
Copy link

gpotte commented Feb 5, 2021

Thanks this worked !!

@snippsat
Copy link

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

@beautytasara27
Copy link

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

@yx135790
Copy link

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

@sinhakrishnendu
Copy link

@beautytasara27 you save me, thank you so much.

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

8 participants