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" #1

Closed
nick3499 opened this issue Oct 3, 2018 · 1 comment
Closed

"IndexError: list index out of range" #1

nick3499 opened this issue Oct 3, 2018 · 1 comment

Comments

@nick3499
Copy link
Owner

nick3499 commented Oct 3, 2018

Traceback (most recent call last):
  File "/usr/local/sbin/glw2", line 79, in <module>
    "\n\033[32m     Temp 1:\033[0m", soup.select("td:nth-of-type(155)")[0].string, "\033[31m|\033[0m",
IndexError: list index out of range

The 155th <td> container had the first soil temperature reading, and the rain data displayed correctly, so the soil temp data was possibly withheld. When I checked again, later this evening, the soil temps displayed correctly.

MIght add a try clause to handle IndexError, but not sure if missing soil temp data was actually the cause.

@nick3499
Copy link
Owner Author

nick3499 commented Oct 3, 2018

Added try statement to soil temperature print call to hopefully resolve the rare IndexError issue when soil temp data seems to be unavailable.

print(table.table)
print(r_table.table)
try:
    print(s_table.table)
except IndexError:
    print("Soil temperature data is unavailable.")

@nick3499 nick3499 closed this as completed Oct 3, 2018
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

1 participant