# Buggy code
def get_converted_relative_path(path, relative_to=os.curdir):
    """Given a vague relative path, return the path relative to the given location"""
    return os.path.join(".", os.path.relpath(path, start=relative_to))


# Traceback (pip9.exceptions.InstallationError)
gtalarico@GUI-STUDIO:~/dev/repos/genome$ pipenv install --dev
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
341, in <listcomp>
c for c in req.parse_requirements(t, session=pip_requests)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_file.py", line 93, in parse_requirements
for req in req_iter:
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_file.py", line 158, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 235, in from_line
wheel_cache=wheel_cache, constraint=constraint)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 91, in __init__
"Invalid requirement: '%s'\n%s" % (req, add_msg))
pip9.exceptions.InstallationError: Invalid requirement: '.\vendor\stargate==0.14.2'
Traceback (most recent call last):
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/packaging/requirements.py", line 92, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1617, in parseString
raise exc
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1607, in parseString
loc, tokens = self._parse( instring, 0 )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3376, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3698, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3359, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 2670, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip9._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
pip9._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'.\\vendor'"
gtalarico@GUI-STUDIO:~/dev/repos/genome$

# Fixed code
def get_converted_relative_path(path, relative_to=os.curdir):
    """Given a vague relative path, return the path relative to the given location"""
    relpath = os.path.relpath(path, start=relative_to)
    if os.name == "nt":
        return os.altsep.join([".", relpath])
    return os.path.join(".", relpath)