Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2022.5.18 incompatible with Python 3.5: AttributeError: module 'os' has no attribute 'PathLike' #195

Closed
Edward-Knight opened this issue May 19, 2022 · 7 comments

Comments

@Edward-Knight
Copy link

The type hinting added in the latest version isn't compatible with Python 3.5, triggering: AttributeError: module 'os' has no attribute 'PathLike'.

Reproduction in an Ubuntu Xenial Docker container:

$ apt update
$ apt install -y python3-pip
$ pip3 install --upgrade "pip<21"  # latest version of pip compatible with 3.5
$ pip3 install certifi==2022.5.18
$ python3 --version
Python 3.5.2
$ python3 -c "import certifi"
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/certifi/core.py", line 14, in <module>
    from importlib.resources import path as get_path, read_text
ImportError: No module named 'importlib.resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/certifi/__init__.py", line 1, in <module>
    from .core import contents, where
  File "/usr/local/lib/python3.5/dist-packages/certifi/core.py", line 46, in <module>
    Resource = Union[str, "os.PathLike"]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
    self._eval_type(globalns, localns)
  File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
AttributeError: module 'os' has no attribute 'PathLike'
@zifban
Copy link

zifban commented May 19, 2022

I have the same problem. PR should solve it by updating python_requires to >=3.6 and dropping support for Python 3.5.

@alex
Copy link
Member

alex commented May 19, 2022

I've gone ahead and merged that PR.

@JoeJasinski
Copy link

JoeJasinski commented May 19, 2022

I'd love to upgrade off of 3.5, but unfortunately can't yet. I know 3.5 not supported. Would it be possible to put in a code path for 3.5? It looks like it just has an issue with this type annotation. It's a shame to break just on that.

https://github.com/certifi/python-certifi/blob/2022.05.18/certifi/core.py#L46

@zifban
Copy link

zifban commented May 20, 2022

The PR solved it for 2022.5.18.1, that won't get installed with Python 3.5. due to the python_requires>=3.6. Unfortunately the release 2022.5.18 still gets installed due to the python_requires>=3.5 still in it and fails in use.

@bparzella
Copy link

Are there any plans to yank the 2022.5.18 from pypi? As python 3.5 pip still sees this release as latest supported version for 3.5, legacy installations still have problems with certifi.

@Lukasa
Copy link
Member

Lukasa commented May 23, 2022

Done.

@alex
Copy link
Member

alex commented May 23, 2022

This should be fixed now.

@alex alex closed this as completed May 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants