Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #45

Open
jveisdal opened this issue Jun 22, 2019 · 2 comments
Open

IndexError: list index out of range #45

jveisdal opened this issue Jun 22, 2019 · 2 comments

Comments

@jveisdal
Copy link

When trying to retrieve stats in Python 3.7.3, I get the following IndexError:

>>> from retrieval import get_data
>>> df = get_data(fname='stats.html')
Found 3 entries in table.
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 128, in process_entry
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 227, in get_data
    return process_in_parallel(t, processes=processes)
  File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 174, in process_in_parallel
    for i, r in enumerate(pool.imap_unordered(process_entry, table_rows_str)):
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
IndexError: list index out of range

Line 128 in retrieval is:

tags = [li.text for li in tags[0].find_all('li')]

Any idea what the problem might be?

@kevb10
Copy link

kevb10 commented Sep 3, 2019

not the most fun answer but the best way to find out what the problem is to learn to debug

import pdb; pdb.set_trace()

@Moemenelkhouly99
Copy link

you can check the axis by panda query and assign it to a variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants