try:
return resources.files(package_name).joinpath(resource_name).open("rb")
- except (ImportError, FileNotFoundError, UnicodeEncodeError):
+ except (ImportError, FileNotFoundError, UnicodeEncodeError, IsADirectoryError):
# There are three types of exception that can be raised that all amount
# to "we cannot find this key":
#
# (e.g. Europe/Krasnoy)
# UnicodeEncodeError: If package_name or resource_name are not UTF-8,
# such as keys containing a surrogate character.
+ # IsADirectoryError: If package_name without a resource_name specified.
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")