question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'

See original GitHub issue

I’m getting an error message when trying to iterate though the calendar events. it then breaks out and give me no data.

Python Version: Python 3.7.3 Installed Version: O365-2.0.14 Host System: Raspberry Pi (Buster)

Calling Code:

     o365_mycalendar = Account.schedule().get_default_calendar()
     o365_mycalendarEvents = o365_calendar.get_events(limit=20, query=o365_calendarQuery, include_recurring=True)
     for o365_event in o365_mycalendarEvents:
          print('E  ', o365_event.start, o365_event.end, o365_event.subject)

Stack Trace

  File "/home/pi/dashdisplay/app_calendar.py", line 214, in process
    for o365_event in o365_mycalendarEvents:
  File "/usr/local/lib/python3.7/dist-packages/O365/calendar.py", line 1740, in <genexpr>
    for event in data.get('value', []))
  File "/usr/local/lib/python3.7/dist-packages/O365/calendar.py", line 897, in __init__
    cc('recurrence'), None))
  File "/usr/local/lib/python3.7/dist-packages/O365/calendar.py", line 137, in __init__
    get_windows_tz(self.protocol.timezone))
  File "/usr/local/lib/python3.7/dist-packages/O365/utils/windows_tz.py", line 639, in get_windows_tz
    iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'

I’m guessing I have a problem somewhere else (ie a system dependency that is not installed), but can’t track down.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hmkimcommented, Aug 20, 2021

I also solved this issue after tzlocal downgrade

pip install tzlocal==2.1

1reaction
mw-debcommented, Aug 16, 2021

Workaround: It helped me to manually install tzlocal on version 2.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
backports.zoneinfo - PyPI
This exposes the backports. zoneinfo module, which is a backport of the zoneinfo module. The backport's documentation can be found on readthedocs. The...
Read more >
Error: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'
I'm getting an error message when trying to iterate though the calendar events. it then breaks out and give me no data. Python...
Read more >
[Example code]-Python ExchangeLib is not working due to the ...
PYTZ_TO_MS_MAP[tz.zone][0] AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'. I tried to solve this but couldn't get the right ...
Read more >
zoneinfo — IANA time zone support — Python 3.11.1 ...
By default, zoneinfo uses the system's time zone data if available; if no system time zone data is available, the library will fall...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found