zebpalmer / WeatherAlerts

Python script to parse the National Weather Service 'Cap' Alerts Feed and do interesting things with it.
MIT License
31 stars 14 forks source link

ValueError: not enough values to unpack (expected 3, got 1) #16

Open mistzy0321 opened 3 years ago

mistzy0321 commented 3 years ago

Relatively dumb when it comes to coding. Tried specifying one SAMECODE, got that. Specified 2, got the same results. Same happened when I tried to use a state. Omitting most of the unnecessary code to save 180 or so lines.

import weatheralerts
from weatheralerts import WeatherAlerts

nws = WeatherAlerts(samecodes='022055') #not my SAMECODE, random one I planned on using to test as it had a flash flood warning in effect
for alert in nws.alerts:
     print(f"{alert.areadesc}: {alert.title}")

Originally was writing to a file as well, but shouldn't make a difference here whether or not I change it to a print string.

ghost commented 3 years ago

Same issue here:

>>> from weatheralerts import WeatherAlerts
>>> nws = WeatherAlerts(samecodes='012057')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/weather_alerts.py", line 27, in __init__
    self.geo = GeoDB()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 17, in __init__
    self.__same = SameCodes()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 95, in __init__
    self._load_same_codes()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 111, in _load_same_codes
    self._cached_same_codes()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 148, in _cached_same_codes
    self.reload()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 104, in reload
    self._load_same_codes(refresh=True)
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 109, in _load_same_codes
    self._get_same_codes()
  File "/opt/homebrew/lib/python3.9/site-packages/weatheralerts/geo.py", line 121, in _get_same_codes
    code, local, state = str(row).strip().split(',')
ValueError: not enough values to unpack (expected 3, got 1)