guptarohit/cryptoCMD

throwing error "list index out of range"

Gaurang10 opened this issue · 3 comments

This is a(n):

  • Error
    CmcScraper is not working. it is givng "list index out of range"

Details:
Below is recreation steps.

Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptocmd import CmcScraper
>>> scraper = CmcScraper("XRP")
>>> 
>>> headers, data = scraper.get_data()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gaurang/anaconda3/lib/python3.6/site-packages/cryptocmd/core.py", line 105, in get_data
    self._download_data(**kwargs)
  File "/home/gaurang/anaconda3/lib/python3.6/site-packages/cryptocmd/core.py", line 84, in _download_data
    self.end_date, self.start_date, self.headers, self.rows = extract_data(table)
  File "/home/gaurang/anaconda3/lib/python3.6/site-packages/cryptocmd/utils.py", line 154, in extract_data
    end_date, start_date = rows[0][0], rows[-1][0]
IndexError: list index out of range
>>> 

@Gaurang10 thanks for reporting the issue! Fixed it, update to the latest release ✌️
Feel free to re-open if the issue persists!

thanks, @guptarohit . I too fixed this issue and was about to raise PR but you beat me in the speed :)

The issue is reoccurring in the latest release version. I tried following code :

import cryptocmd
import datetime
from cryptocmd import CmcScraper
from datetime import datetime

scraper_btc = CmcScraper("btc", "01-01-2013", "20-11-2019")
df_btc = scraper_btc.get_dataframe()