Traceback most recent call last File Dpython学习垃圾桶Apy line 40 in module elevation azimuth = calculate_sun_positionlatitude longitude date_time ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This error occurs because you are trying to access the total_seconds() method on a NoneType object. The NoneType object in this case refers to the return value of date_time.utcoffset().
The utcoffset() method returns the offset of the datetime object's timezone from UTC. However, if the date_time object does not have a timezone information or if it is set to None, then utcoffset() will return None.
To fix this error, you need to make sure that the date_time object has a valid timezone information before calling the utcoffset() method. You can do this by either setting the timezone explicitly when creating the date_time object or by using a different method to calculate the UTC offset
原文地址: https://www.cveoy.top/t/topic/i1d2 著作权归作者所有。请勿转载和采集!