Open lnxq opened 1 year ago
seems like the same issue as this one? https://github.com/mortada/fredapi/issues/50
upgrading to the latest version should solve this
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!
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!