Open zinovevvv opened 2 years ago
Hi, same problem here - I am looping through a list of stocks and getting dividents, but recently after adding a couple of new positions got that error as well:
Traceback (most recent call last):
File "/Users/ash/opt/anaconda3/lib/python3.9/site-packages/investpy/stocks.py", line 908, in get_stock_dividends
dividend_value = float(element_.getnext().text_content().replace(',', ''))
Code I am using to get dividents:
stock_info = investpy.stocks.get_stock_dividends(stock, country=country_data[countryiterator])
I managed to deal with this error by simply skipping stocks with such an error by using try/except clause like this:
except ValueError:
print(' - ', stock, ' - DATA NOT FOUND')
I will try to dive into the source code and deal with this problem :)
Added error list:
KO US PEP US O US
Hello!
I get this error for some stocks:
In [2]: import investpy
In [3]: investpy.get_stock_dividends('USB', 'united states')
ValueError Traceback (most recent call last)