Skip to content

gettz on Python 3 fails with TypeError when passed bytes #927

@labrys

Description

@labrys

Given the following code on Python 3.7:

import dateutil.tz
dateutil.tz.gettz(b'America/New_York')

A TypeError is raised:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lib/python3.7/site-packages/dateutil/tz/tz.py", line 1551, in __call__
    rv = self.nocache(name=name)
  File "lib/python3.7/site-packages/dateutil/tz/tz.py", line 1612, in nocache
    if name.startswith(":"):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions