Misleading error message when Pipfile is removed
See original GitHub issueIssue description
When I remove the file Pipfile.lock
it fails with a traceback:
...
File "/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv/utils.py", line 355, in venv_resolve_deps
escape_grouped_arguments(which("python", allow_global=allow_global)),
File "/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv/core.py", line 109, in which
if not location and os.path.exists(location):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
When I remove Pipfile
it fails with another traceback:
File "/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv/core.py", line 320, in ensure_pipfile
project.create_pipfile(python=python)
File "/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv/project.py", line 627, in create_pipfile
config_parser = ConfigOptionParser(name=self.name)
File "/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv/project.py", line 219, in name
self._name = self.pipfile_location.split(os.sep)[-2]
AttributeError: 'NoneType' object has no attribute 'split'
Expected result
I would expect a proper error message that some required file is missing. I would expect such behavior from a high-level beginner-friendly software 😃
In case of the lock file I would expect a new lock file to be created (similar to npm, for example).
In the second case, the error happens inside create_pipfile
, so maybe it is trying to create the pipflle, but still fails. So maybe it’s an another issue?
$ pipenv --support
Pipenv version: '2018.10.9'
Pipenv location: '/Users/messa/code/gh/naucse.python.cz/myvenv/lib/python3.7/site-packages/pipenv'
Python location: '/Users/messa/code/gh/naucse.python.cz/myvenv/bin/python'
Python installations found:
3.7.0
:/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
3.7.0
:/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
3.6.6
:/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
3.6.6
:/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m
3.5.6
:/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m
3.5.6
:/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
2.7.15
:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
2.7.10
:/usr/bin/python
2.7.10
:/usr/bin/pythonw
2.7.10
:/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.0',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '17.7.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT '
'2018; root:xnu-4570.71.2~1/RELEASE_X86_64',
'python_full_version': '3.7.0',
'python_version': '3.7',
'sys_platform': 'darwin'}
System environment variables:
LANG
XPC_FLAGS
DISPLAY
OLDPWD
TERM_SESSION_ID
COLORTERM
__CF_USER_TEXT_ENCODING
ITERM_SESSION_ID
SSH_AUTH_SOCK
VIRTUAL_ENV
USER
PWD
HOME
TERM_PROGRAM
TERM_PROGRAM_VERSION
Apple_PubSub_Socket_Render
ITERM_PROFILE
TMPDIR
XPC_SERVICE_NAME
TERM
SHELL
SHLVL
COLORFGBG
LOGNAME
PATH
PS1
_
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/Users/messa/code/gh/naucse.python.cz/myvenv/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/local/libexec/gnubin
SHELL
:/bin/bash
LANG
:cs_CZ.UTF-8
PWD
:/Users/messa/code/gh/naucse.python.cz
VIRTUAL_ENV
:/Users/messa/code/gh/naucse.python.cz/myvenv
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
I am running into a similar problem when trying to import from a requirements file; it seems that because the Pipfile.lock is out of date it tries to remove it and fails.
Yields:
This only seems to be a problem if the virtualenv is on. Thanks for the hard work maintaining this package!
Yes, software has bugs in it. This one is maintained by usually 1-2 volunteers at most. Please try to keep the conversation productive.
When you remove pipfile.lock, what fails? You removed your lockfile and then ran what command specifically? It’s not clear what happened here from the snipped output