Skip to content

Commit

Permalink
Add helpful message when passed bytes to gettz
Browse files Browse the repository at this point in the history
  • Loading branch information
labrys authored and pganssle committed Nov 2, 2019
1 parent 27848c5 commit e39eb98
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dateutil/tz/tz.py
Expand Up @@ -1615,8 +1615,14 @@ def nocache(name=None):
else:
tz = tzlocal()
else:
if name.startswith(":"):
name = name[1:]
try:
if name.startswith(":"):
name = name[1:]
except TypeError:
if isinstance(name, bytes):
raise TypeError('gettz arg should be str, not bytes')
else:
raise
if os.path.isabs(name):
if os.path.isfile(name):
tz = tzfile(name)
Expand Down

0 comments on commit e39eb98

Please sign in to comment.