Skip to content

pip exception parsing last_check datetime #12338

Closed
@belm0

Description

@belm0

Description

pip wheel fails when parsing last_check due to lack of Z suffix support by datetime.fromisoformat().

It looks like the fromisoformat() call was added recently, and indeed there was concern in the PR about handling Z. @pfmoore @pgan

Expected behavior

pip install does not having an error parsing last_check

pip version

23.3.dev0

Python version

3.8

OS

linux

How to Reproduce

  1. git clone https://github.com/pypa/pip.git
  2. cd pip
  3. python3.8 -m venv venv
  4. source venv/bin/activate
  5. pip install -e .
  6. pip wheel -vv scipy==1.10.1

Output

WARNING: There was an error checking the latest version of pip.
See below for error
Traceback (most recent call last):
  File "/Users/john/tmp/pip/src/pip/_internal/self_outdated_check.py", line 227, in pip_self_version_check
    upgrade_prompt = _self_version_check_logic(
  File "/Users/john/tmp/pip/src/pip/_internal/self_outdated_check.py", line 188, in _self_version_check_logic
    remote_version_str = state.get(current_time)
  File "/Users/john/tmp/pip/src/pip/_internal/self_outdated_check.py", line 76, in get
    last_check = datetime.datetime.fromisoformat(self._state["last_check"])
ValueError: Invalid isoformat string: '2023-10-11T17:07:57Z'

(aside: an error should be logged as ERROR, not WARNING)

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: needs triageIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions