Skip to content

AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' When Attempting To Obtain Data: N.B. fredapi In Clean Anaconda Installation Running In Jupyter Lab Notebook In Dedicated Virtual Environment #64

Description

@lnxq

Using clean Anaconda install with JupyterLab notebook in a dedicated virtual environment:

from fredapi import Fred
fred = Fred(api_key='#####')
data = fred.get_series('SP500')

AttributeError Traceback (most recent call last)
Cell In[7], line 1
----> 1 data = fred.get_series('SP500')

File ~\anaconda3\envs\venv_1\Lib\site-packages\fredapi\fred.py:135, in Fred.get_series(self, series_id, observation_start, observation_end, **kwargs)
133 raise ValueError('No data exists for series id: ' + series_id)
134 data = {}
--> 135 for child in root.getchildren():
136 val = child.get('value')
137 if val == self.nan_char:

AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

I am still quite new to python, and suppose it is something obvious, but I have no idea why this isn't working since it looks very straight forward in all the docs.

Any help would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions