my code is
from forex_python.converter import CurrencyRates
forex = CurrencyRates.get_rates('USD', 'EUR')
print(forex)
the error I get is the following:
File "/Users/asjbentley/opt/anaconda3/lib/python3.7/site-packages/forex_python/untitled0.py", line 12, in <module>
forex = CurrencyRates.get_rates('USD', 'EUR')
File "/Users/asjbentley/opt/anaconda3/lib/python3.7/site-packages/forex_python/converter.py", line 55, in get_rates
date_str = self._get_date_string(date_obj)
AttributeError: 'str' object has no attribute '_get_date_string'
I have done the pip install of the package. The function the error is referring to is in their package. This is a simple script which I should have no issues running.
Looking at the source code,
get_ratesis a function that accepts abase_curas first argument and adate_objas second argument. So if you pass astrto the second argument, it'll try to use adatetime.datetimeobject and it'll throw the error.Maybe you meant
get_rate, withbase_curas first argument anddest_curas second argument (bothstrs)?