Skip to content

IndexError: list index out of range #30

@dneise

Description

@dneise

SH was calling me every hour or two during the last night since we use sfc 0.4.1 for the first time.

I was able to reproduce the problem first time this way:

while True:
    print(time.asctime(), sfc.main_page())

Got this:

Tue Jan 23 08:03:01 2018 single-pe(179) [104/02:09]
Tue Jan 23 08:03:02 2018 single-pe(179) [104/02:09]
Tue Jan 23 08:03:02 2018 single-pe(179) [104/02:09]
Tue Jan 23 08:03:02 2018 Idle [single-pe]
Tue Jan 23 08:03:03 2018 Idle [single-pe]
Tue Jan 23 08:03:03 2018 Idle [single-pe]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-5-13fe3da96b99> in <module>()
      1 while True:
----> 2     print(time.asctime(), sfc.main_page().system_status)
      3 

~/fact/smart_fact_crawler/smart_fact_crawler/__init__.py in main_page(url, timeout, fallback)
    317     system_status = get(table, 1, 1)
    318     power_val, power_unit = get(table, 6, 3, default='nan nan').split()
--> 319     trigger_val, trigger_unit, _ = get(table, 5, 1, default='nan nan nan').split()
    320     return to_namedtuple('MainPage', {
    321         'timestamp_1': sft2dt(get(table, 0, 0)),

~/fact/smart_fact_crawler/smart_fact_crawler/tools.py in get_entry(table, row, col, fallback, default)
     56 
     57     try:
---> 58         return table[row][col]
     59     except IndexError:
     60         if fallback is True:

IndexError: list index out of range

So it happened just after the single-pe run in the end of the night ... maybe this is the reason why it called me only sometimes ...

If we set fallback=True ... then we do not get an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions