# Buggy code
def parse_path(path):
    """Parse a dataset's identifier or path into its parts

    Parameters
    ----------
    path : str or path-like object
        The path to be parsed.

    Returns
    -------
    ParsedPath or UnparsedPath

    Notes
    -----
    When legacy GDAL filenames are encountered, they will be returned
    in a UnparsedPath.
    """
    if isinstance(path, Path):
        return path

    # Windows drive letters (e.g. "C:\") confuse `urlparse` as they look like
    # URL schemes
    elif sys.platform == "win32" and re.match("^[a-zA-Z]\\:", path):
        return UnparsedPath(path)

    elif path.startswith("/vsi"):
        return UnparsedPath(path)

    else:
        parts = urlparse(path)

        # if the scheme is not one of Rasterio's supported schemes, we
        # return an UnparsedPath.
        if parts.scheme and not all(p in SCHEMES for p in parts.scheme.split("+")):
            return UnparsedPath(path)

        else:
            return ParsedPath.from_uri(path)


# Traceback (fiona._err.CPLE_OpenFailedError)
mkdir !test
copy test.geojson !test\test.geojson
python

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import fiona
with fiona.open("!test\test.geojson") as src:
...     src.crs
...
Traceback (most recent call last):
File "fiona\_shim.pyx", line 73, in fiona._shim.gdal_open_vector
File "fiona\_err.pyx", line 270, in fiona._err.exc_wrap_pointer
fiona._err.CPLE_OpenFailedError: 'test  est.geojson' does not exist in the file system, and is not recognized as a supported dataset name.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\env.py", line 406, in wrapper
return f(*args, **kwargs)
File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\__init__.py", line 257, in open
layer=layer, enabled_drivers=enabled_drivers, **kwargs)
File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\collection.py", line 159, in __init__
self.session.start(self, **kwargs)
File "fiona\ogrext.pyx", line 484, in fiona.ogrext.Session.start
File "fiona\_shim.pyx", line 80, in fiona._shim.gdal_open_vector
fiona.errors.DriverError: 'test est.geojson' does not exist in the file system, and is not recognized as a supported dataset name.


# Fixed code
def parse_path(path):
    """Parse a dataset's identifier or path into its parts

    Parameters
    ----------
    path : str or path-like object
        The path to be parsed.

    Returns
    -------
    ParsedPath or UnparsedPath

    Notes
    -----
    When legacy GDAL filenames are encountered, they will be returned
    in a UnparsedPath.
    """
    if isinstance(path, Path):
        return path

    # Windows drive letters (e.g. "C:\") confuse `urlparse` as they look like
    # URL schemes
    elif sys.platform == "win32" and re.match("^[a-zA-Z]\\:", path):
        return UnparsedPath(path)

    elif path.startswith("/vsi"):
        return UnparsedPath(path)

    elif re.match("^[a-z\\+]*://", path):
        parts = urlparse(path)

        # if the scheme is not one of Rasterio's supported schemes, we
        # return an UnparsedPath.
        if parts.scheme and not all(p in SCHEMES for p in parts.scheme.split("+")):
            return UnparsedPath(path)

        else:
            return ParsedPath.from_uri(path)

    else:
        return UnparsedPath(path)