Skip to content

AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' when running python3 flickr_scraper.py #8

Open
@cjgetty

Description

Traceback (most recent call last):
  File "/Users/cjgetty/Desktop/flickr_scraper/flickr_scraper.py", line 66, in <module>
    get_urls(search=opt.search,  # search term
  File "/Users/cjgetty/Desktop/flickr_scraper/flickr_scraper.py", line 31, in get_urls
    for i, photo in enumerate(photos):
  File "/opt/homebrew/Caskroom/miniforge/base/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'

Activity

s4lm-xi

s4lm-xi commented on May 3, 2022

@s4lm-xi

I was able to fix the issue myself by editing the core.py file. The file should be inside the following path python3.x/site-packages/flickrapi/core.py

replace line 690 with photoset = list(rsp)[0]. That should resolve the issue

getchildren method is deprecated, check out the documentation

glenn-jocher

glenn-jocher commented on May 3, 2022

@glenn-jocher
Member

@s4lm-xi thanks for the fix idea! Can you please submit a PR with your updates to help future uses?

s4lm-xi

s4lm-xi commented on May 3, 2022

@s4lm-xi

the issue is from the flickrapi module. The current latest version is 2.4.0 and it doesn't include the fix. however in the flickr github repo the issue is fixed. But there is not an available version to install.

glenn-jocher

glenn-jocher commented on May 3, 2022

@glenn-jocher
Member

Got it, thanks!

15177759775

15177759775 commented on Jan 30, 2023

@15177759775

It works.Thanks!

rmozart

rmozart commented on Jul 4, 2023

@rmozart

Thanks, @s4lm-xi ! It worked real nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' when running python3 flickr_scraper.py Β· Issue #8 Β· ultralytics/flickr_scraper