Skip to content

Commit

Permalink
Handle bad/float lsFromStar values from maddavo
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Smith committed Mar 6, 2015
1 parent a66b670 commit 5e2206e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion plugins/maddavo_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,20 @@ def import_stations(self):

generator = self.csv_station_rows(STATIONS_URL, "Stations")
for system, stnName, station, values in generator:
lsFromStar = int(values[2])
try:
lsFromStar = float(values[2])
except ValueError:
tdenv.WARN(
"Invalid, non-numeric, lsFromStar value ('{}') for {}/{}",
values[2], system.name(), stnName
)
continue
if int(lsFromStar) != lsFromStar:
tdenv.NOTE(
"Discarding floating-point part of {} for {}/{}",
lsFromStar, system.name(), stnName
)
lsFromStar = int(lsFromStar)
modified = values[7] if len(values) > 6 else 'now'
if lsFromStar < 0 or modified.startswith("DEL"):
if station:
Expand Down

0 comments on commit 5e2206e

Please sign in to comment.