File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -14,21 +14,19 @@ def load_tzdata(key):
1414 if path .is_dir ():
1515 raise IsADirectoryError
1616 return path .open ("rb" )
17- except UnicodeEncodeError :
18- # This error occurs because of unsupported filesystem encoding which
19- # depends on the locale, such as keys containing a surrogate character.
20- ZoneInfoNotFoundError (f"key { key } contains non-UTF8 character(s)" )
2117 except (ImportError , FileNotFoundError , UnicodeEncodeError , IsADirectoryError ):
22- # There are three other types of exception that can be raised that
23- # all amount to "we cannot find this key":
18+ # There are four types of exception that can be raised that all amount
19+ # to "we cannot find this key":
2420 #
2521 # ImportError: If package_name doesn't exist (e.g. if tzdata is not
2622 # installed, or if there's an error in the folder name like
2723 # Amrica/New_York)
2824 # FileNotFoundError: If resource_name doesn't exist in the package
2925 # (e.g. Europe/Krasnoy)
26+ # UnicodeEncodeError: If package_name or resource_name are not UTF-8,
27+ # such as keys containing a surrogate character.
3028 # IsADirectoryError: If package_name without a resource_name specified.
31- raise ZoneInfoNotFoundError (f"No time zone found with key { key } " )
29+ raise ZoneInfoNotFoundError (f"No time zone found with key { key !r } " )
3230
3331
3432def load_data (fobj ):
You can’t perform that action at this time.
0 commit comments