AttributeError:“module”对象没有属性“get\u altitude”

2024-09-30 01:20:53 发布

您现在位置:Python中文网/ 问答频道 /正文

py代码的这一部分抛出了AttributeError

def tomorrow_heading():
    increment_min = 1
    incrementeddatetime = 0
    tomorrow_corrected = 90
    if pysolar.get_altitude(maplat, maplon, datetime.datetime.utcnow()) < 0:
        while pysolar.get_altitude(maplat, maplon, (datetime.datetime.utcnow() + datetime.timedelta(minutes=incrementeddatetime))) < 0:
          incrementeddatetime = incrementeddatetime + increment_min
        sunrise_time=(datetime.datetime.utcnow() + datetime.timedelta(minutes=incrementeddatetime))
        tomorrow_heading = pysolar.GetAzimuth(maplat, maplon, sunrise_time)
        if tomorrow_heading < 0:
            if (tomorrow_heading >= -180):
                tomorrow_corrected = ((tomorrow_heading * -1) + 180)
            if (tomorrow_heading < -180):
                tomorrow_corrected = ((tomorrow_heading * -1) - 180)
        if tomorrow_heading >= 0:

以下是错误代码

^{pr2}$

我在谷歌上搜索了一段时间,似乎找不到答案。solarrobot7.py中的原始代码使用了GetAltitude和{}(PascalCase),我将其改为get_altitude和{}(snake\ucase)。在


Tags: 代码pygetdatetimeiftomorrowutcnowaltitude

热门问题