Python 由于 backports.zoneinfo.ZoneInfo 错误,ExchangeLib 无法正常工作
Python ExchangeLib is not working due to the backports.zoneinfo.ZoneInfo error
我正在尝试使用 ExchangeLib 向 Outlook 发送电子邮件。但是,它因以下错误而失败。
File "DeliverEmailResult.py", line 31, in __init__
credentials=Credentials(self._from_user, self._password),
File "C:\Users\..\Email Delivery\emailenv\lib\site-packages\exchangelib\account.py", line 92, in __init__
self.default_timezone = default_timezone or EWSTimeZone.localzone()
File "C:\Users\..Email Delivery\emailenv\lib\site-packages\exchangelib\ewsdatetime.py", line 264, in localzone
return cls.from_pytz(tz)
File "C:\Users\..Email Delivery\emailenv\lib\site-packages\exchangelib\ewsdatetime.py", line 244, in from_pytz
self_cls.ms_id = cls.PYTZ_TO_MS_MAP[tz.zone][0]
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'
我试图解决这个问题,但找不到正确的答案。请帮助某人确定确切的问题。如果此解决方案有或没有其他替代方案,请告知。欢迎所有建议
提前致谢
这已在 exchangelib 3.3 中修复。您需要升级exchangelib版本。
我正在尝试使用 ExchangeLib 向 Outlook 发送电子邮件。但是,它因以下错误而失败。
File "DeliverEmailResult.py", line 31, in __init__
credentials=Credentials(self._from_user, self._password),
File "C:\Users\..\Email Delivery\emailenv\lib\site-packages\exchangelib\account.py", line 92, in __init__
self.default_timezone = default_timezone or EWSTimeZone.localzone()
File "C:\Users\..Email Delivery\emailenv\lib\site-packages\exchangelib\ewsdatetime.py", line 264, in localzone
return cls.from_pytz(tz)
File "C:\Users\..Email Delivery\emailenv\lib\site-packages\exchangelib\ewsdatetime.py", line 244, in from_pytz
self_cls.ms_id = cls.PYTZ_TO_MS_MAP[tz.zone][0]
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'
我试图解决这个问题,但找不到正确的答案。请帮助某人确定确切的问题。如果此解决方案有或没有其他替代方案,请告知。欢迎所有建议 提前致谢
这已在 exchangelib 3.3 中修复。您需要升级exchangelib版本。