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

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

Open
lnxq opened this issue Apr 24, 2023 · 2 comments

Comments

@lnxq
Copy link

lnxq commented Apr 24, 2023

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!

@mortada
Copy link
Owner

mortada commented Apr 24, 2023

seems like the same issue as this one? #50

upgrading to the latest version should solve this

@lnxq
Copy link
Author

lnxq commented Apr 25, 2023

mortada, Thank You for the response, it is greatly appreciated!

I resolved this issue by creating a new virtual environment using straight-up python and pip - NO ANACONDA - and it is working.

I think there is too much baggage with Anaconda, whereas regular python keeps things purer and simpler to work with, albeit from a CLI. (PURE EDITORIAL COMMENT)

I have experienced issues with other virtual environments and scripts using Anaconda to the point of doing a full reinstall of Anaconda. Even after the reinstall issues persisted. I am of the present opinion of jettisoning Anaconda going forward. There is no need for it, and it muddles the process and environments related to scripting.

Best regards, and thank you for fredapi, and your response!

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

2 participants