AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'
See original GitHub issueI am facing this error when I try to use calendar.
import datetime as dt
from O365 import Account, FileSystemTokenBackend
import os
import re
CLIENT_SECRET = 'xxxxxxx'
CLIENT_ID = 'xxxxxxxxxx'
TENANT_ID = 'xxxxxxxxxxxxxxx'
EMAIL_ID = 'xxxxxxxxxxxxxxx'
def calendar_event():
credentials = (CLIENT_ID, CLIENT_SECRET)
token_backend = FileSystemTokenBackend(token_path=os.getcwd(), token_filename='my_token.txt')
account = Account(credentials, tenant_id=TENANT_ID, auth_flow_type='credentials', token_backend=token_backend)
# Checking whether the client is authenticated.
if not account.is_authenticated:
try:
account.authenticate()
print('Authenticated!\n')
except Exception as e:
print("Exception: ", e)
print("Authentication Failed!\n")
else:
print('Already Authenticated!\n')
schedule = account.schedule(resource=EMAIL_ID)
# print(schedule)
calendar = schedule.get_default_calendar()
print(calendar)
new_event = calendar.new_event() # creates a new unsaved event
# print(new_event)
new_event.subject = 'Recruit George Best!'
new_event.location = 'England'
# naive datetimes will automatically be converted to timezone aware datetime
# objects using the local timezone detected or the protocol provided timezone
# new_event.start = datetime.now()
new_event.start = dt.datetime(2021, 9, 7, 11, 45)
# new_event.recurrence.set_daily(1, end=dt.datetime(2019, 9, 10))
# new_event.remind_before_minutes = 45
new_event.save()
if __name__ == '__main__':
calendar_event()
The error I am facing
Traceback (most recent call last):
File "C:\Users\karnayak\PycharmProjects\email_processing\calendar-processing.py", line 52, in <module>
calendar_event()
File "C:\Users\karnayak\PycharmProjects\email_processing\calendar-processing.py", line 35, in calendar_event
new_event = calendar.new_event() # creates a new unsaved event
File "C:\Users\karnayak\PycharmProjects\email_processing\lib\site-packages\O365\calendar.py", line 1754, in new_event
Calendar: Calendar from Karthik Nayak (karthiknayak@gmail.com)
return self.event_constructor(parent=self, subject=subject,
File "C:\Users\karnayak\PycharmProjects\email_processing\lib\site-packages\O365\calendar.py", line 895, in __init__
self.__recurrence = EventRecurrence(event=self,
File "C:\Users\karnayak\PycharmProjects\email_processing\lib\site-packages\O365\calendar.py", line 137, in __init__
get_windows_tz(self.protocol.timezone))
File "C:\Users\karnayak\PycharmProjects\email_processing\lib\site-packages\O365\utils\windows_tz.py", line 639, in get_windows_tziana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'
Process finished with exit code 1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error: 'backports.zoneinfo.ZoneInfo' object has no attribute ...
I'm getting an error message when trying to iterate though the calendar events. it then breaks out and give me no data.
Read more >Python ExchangeLib is not working due to the backports ...
PYTZ_TO_MS_MAP[tz.zone][0] AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'. I tried to solve this but couldn't ...
Read more >AttributeError: 'LocalTimezone' object has no attribute 'normalize'
Getting an error "AttributeError: 'LocalTimezone' object has no attribute 'normalize'" when trying to access irclogs. I'm running pytz 2008c, Python 2.5 on ...
Read more >zoneinfo — IANA time zone support — Python 3.11.1 ...
If no file matching key is found, the constructor will raise ZoneInfoNotFoundError . The ZoneInfo class has two alternate constructors: classmethod ZoneInfo.
Read more >backports.zoneinfo - PyPI
To get access to time zones with this module, construct a ZoneInfo object and attach it to your datetime: >>> from backports.zoneinfo import...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll try to release a new version today
Done