Skip to content

ImportError on Python 3.10: cannot import UTC from datetime #3

@JoeCardoso13

Description

@JoeCardoso13

Bug

Running the echo bundle on Python 3.10 fails with:

ImportError: cannot import name 'UTC' from 'datetime' (/usr/lib/python3.10/datetime.py)

Cause

datetime.UTC was introduced in Python 3.11. The import in server.py line 7:

from datetime import UTC, datetime

should be changed to use datetime.timezone.utc for compatibility with Python 3.10+.

Reproduction

mpak run @nimblebraininc/echo

on a system with Python 3.10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions