InvalidFileFormatError

class pydriosm.errors.InvalidFileFormatError(osm_file_format, valid_file_formats=None)

Exception raised when an input osm_file_format is not recognizable.

Parameters
  • osm_file_format (str) – file format/extension of the OSM data on the free download server

  • valid_file_formats (Iterable or None) – filename extensions of the data files available on the free download server, defaults to None

Ivar

str osm_file_format: file format/extension of the OSM data on the free download server

Ivar

int or None message: error message

Examples:

>>> from pydriosm.errors import InvalidFileFormatError

>>> raise InvalidFileFormatError(osm_file_format='abc')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidFileFormatError:
  `osm_file_format='abc'` -> The input `osm_file_format` is unidentifiable.

>>> from pydriosm.downloader import GeofabrikDownloader, BBBikeDownloader

>>> gfd = GeofabrikDownloader()
>>> gfd.validate_file_format(osm_file_format='abc')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidFileFormatError:
  `osm_file_format='abc'` -> The input `osm_file_format` is unidentifiable.
    Valid options include: {'.shp.zip', '.osm.pbf', '.osm.bz2'}.

>>> bbd = BBBikeDownloader()
>>> bbd.validate_file_format(osm_file_format='abc')
Traceback (most recent call last):
  ...
pydriosm.errors.InvalidFileFormatError:
  `osm_file_format='abc'` -> The input `osm_file_format` is unidentifiable.
    Valid options include: {'.shp.zip', '.geojson.xz', '.mapsforge-osm.zip', '.pbf', ...