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_rates
is a function that accepts abase_cur
as first argument and adate_obj
as second argument. So if you pass astr
to the second argument, it'll try to use adatetime.datetime
object and it'll throw the error.Maybe you meant
get_rate
, withbase_cur
as first argument anddest_cur
as second argument (bothstr
s)?