InvalidSubregionNameError

class pydriosm.errors.InvalidSubregionNameError(subregion_name, msg=None)[source]

Exception raised when an input subregion_name is not recognizable.

Parameters:
  • subregion_name (str) – name of a (sub)region available on a free download server

  • msg (int | None) – index of optional messages, defaults to None; options include {1, 2}

Ivar:

str subregion_name: name of a (sub)region available on a free download server

Ivar:

int | None msg: index of optional messages; options include {1, 2}

Ivar:

str: error message

Examples:

>>> from pydriosm.errors import InvalidSubregionNameError

>>> raise InvalidSubregionNameError(subregion_name='abc')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidSubregionNameError:
  `subregion_name='abc'` -> The input of `subregion_name` is not recognizable.
  Check the `.data_source`, or try another one instead.

>>> from pydriosm.downloader import GeofabrikDownloader, BBBikeDownloader

>>> gfd = GeofabrikDownloader()
>>> gfd.validate_subregion_name(subregion_name='birmingham')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidSubregionNameError:
  `subregion_name='birmingham'`
    1) `subregion_name` fails to match any in `<downloader>.valid_subregion_names`; or
    2) The queried (sub)region is not available on the free download server.

>>> bbd = BBBikeDownloader()
>>> bbd.validate_subregion_name(subregion_name='bham')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidSubregionNameError:
  `subregion_name='bham'` -> The input of `subregion_name` is not recognizable.
  Check the `.data_source`, or try another one instead.