Cannot import pytz in python3.9

Bug #1851298 reported by Pat Viafore
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
Fix Released
High
Unassigned

Bug Description

In what's new for Python3.9, they mentioned that collections will not import collections.abc base classes by default : https://docs.python.org/3.9/whatsnew/3.9.html. This means that lines like from collections import Mapping won't work anymore (it will have to be from collections.abc import Mapping.

As such, when trying to import pytz in Python3.9 will give the following error:

>>> import pytz
Traceback (most recent call last):
  File "/home/pat/.pyenv/versions/3.9-dev/lib/python3.9/site-packages/pytz/lazy.py", line 3, in <module>
    from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pat/.pyenv/versions/3.9-dev/lib/python3.9/site-packages/pytz/__init__.py", line 32, in <module>
    from pytz.lazy import LazyDict, LazyList, LazySet
  File "/home/pat/.pyenv/versions/3.9-dev/lib/python3.9/site-packages/pytz/lazy.py", line 5, in <module>
    from collections import Mapping as DictMixin
ImportError: cannot import name 'Mapping' from 'collections' (/home/pat/.pyenv/versions/3.9-dev/lib/python3.9/collections/__init__.py)
>>>

Stuart Bishop (stub)
Changed in pytz:
status: New → Triaged
importance: Undecided → High
Stuart Bishop (stub)
Changed in pytz:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.