Closed ds-oliver closed 2 weeks ago
Although I didn't change this intentionally, I prefer tz-aware datetime objects. Naive datetime objects are Python-only abstractions that don't identify anything in the real world; they're highly error prone and sort of work properly only if used in a limited scope where you work in a specific time zone.
Is it correct that the schedule["date"] <= datetime.now()
comparison is in your script? Then I would suggest using datatime.utcnow()
instead.
Issue: TypeError in DateTime Comparison After Update
Description
After updating the
soccerdata
repository, I encountered aTypeError
when comparing datetime objects in my script. The error suggests an invalid comparison between tz-naive and tz-aware datetime-like objects. This issue did not occur before the update.Error Traceback
Steps to Reproduce
soccerdata
repository.TypeError
during the comparison of datetime objects.Expected Behavior
The script should successfully compare datetime objects without raising a
TypeError
.Environment
Additional Information
Suggested Fix
Ensure the datetime objects being compared are either both tz-naive or both tz-aware. Possible solution is to convert
schedule["date"]
to tz-naive before comparison.Thank you for your assistance.