This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ntpath join doesnt check whether path variable None or not
Type: Stage: resolved
Components: Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: usta, xiang.zhang
Priority: normal Keywords:

Created on 2018-06-17 23:13 by usta, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg319835 - (view) Author: Ömer FADIL USTA (usta) Date: 2018-06-17 23:13
def join(path, *paths):
path = os.fspath(path)

the path variable used directly in fspath method without checking is exist or not so it cause :

  File "d:\python\37\lib\", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\python\37\lib\", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Python\37\Scripts\pipenv.exe\", line 9, in <module>
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 722, in __call__
    return self.main(*args, **kwargs)
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 697, in main
    rv = self.invoke(ctx)
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 535, in invoke
    return callback(*args, **kwargs)
  File "d:\python\37\lib\site-packages\pipenv\vendor\click\", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "d:\python\37\lib\site-packages\pipenv\", line 217, in cli
  File "d:\python\37\lib\site-packages\pipenv\", line 1703, in do_py
    click.echo(which('python', allow_global=system))
  File "d:\python\37\lib\site-packages\pipenv\", line 125, in which
    os.path.join(location, 'Scripts'), command
  File "d:\python\37\lib\", line 76, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType'. Make sure pipenv is on the PATH.
msg320081 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2018-06-20 14:57
This is not a bug in ntpath. Raising a TypeError is a normal behavior when passed a wrong argument and I think the error message tells good info. You should figure out why pipenv passes a None to os.path.join.
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 78072
2018-06-20 14:57:59xiang.zhangsetstatus: open -> closed

type: crash ->

nosy: + xiang.zhang
messages: + msg320081
resolution: not a bug
stage: resolved
2018-06-17 23:13:30ustacreate