You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several of us have been using the astral 3 release, and have run into a problem where something we have done is causing a ValueError to be raised, and then astral is unable to handle the error. The specific error arise in sun.py around line 955 in the code, in these lines
if tot_date != date:
if tot_date < date:
delta = datetime.timedelta(days=1)
else:
delta = datetime.timedelta(days=-1)
new_date = date + delta
tot = time_of_transit(
observer,
new_date,
90.0 + dep,
SunDirection.SETTING,
).astimezone(
tzinfo # type: ignore
)
tot_date = tot.date()
if tot_date != date:
raise ValueError
return tot
except ValueError as exc:
if exc.args[0] == "math domain error":
raise ValueError(
f"Sun never reaches {dep} degrees below the horizon, at this location."
) from exc
else:
raise
The if statement at the top fail,s which causes the ValueErrror to be raised.
But the problem is that exc.args is actually empty. exc.args[0]. does not exist and this causes if statement, in the line
if exc.args[0] == "math domain error":
to break.
I am not an expert on this, but it looked like there were a number of places in the code, where something similar might happen. As a result of this, we have dropped back to using version 2.2 of astral, which does generate the original problem for us, with the same inputs. We have however not tried to understand this.
The text was updated successfully, but these errors were encountered:
Several of us have been using the astral 3 release, and have run into a problem where something we have done is causing a ValueError to be raised, and then astral is unable to handle the error. The specific error arise in sun.py around line 955 in the code, in these lines
The if statement at the top fail,s which causes the ValueErrror to be raised.
But the problem is that exc.args is actually empty. exc.args[0]. does not exist and this causes if statement, in the line
to break.
I am not an expert on this, but it looked like there were a number of places in the code, where something similar might happen. As a result of this, we have dropped back to using version 2.2 of astral, which does generate the original problem for us, with the same inputs. We have however not tried to understand this.
The text was updated successfully, but these errors were encountered: