You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During a pipenv install pyodbc with a Pipfile that has multiple sources it seems pipenv reorganizes the Pipfile to have all [[sources]] blocks at the top.
However, this reordering will fail if the last line is missing a trailing new-line
(note that I am using twice pypi.org, in our case this would be a private registry). Note that this Pipfile should NOT have a trailing newline after the last name = "pypi2" line!
Expected result
Using the above mentioned Pipfile in the statement
Executing the statement
`pipenv install --verbose --extra-pip-args "--dry-run" pyodbc
with the above mentioned Pipfile results in the following error:
pipenv install --verbose --extra-pip-args "--dry-run" pyodbc
Requirements file provided! Importing into Pipfile...
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pipenv/project.py", line 700, in _parse_pipfile
return tomlkit.parse(contents)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/api.py", line 86, in parse
return Parser(string).parse()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 154, in parse
key, value = self._parse_table()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 1038, in _parse_table
result = self._parse_aot(result, full_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 1079, in _parse_aot
_, table = self._parse_table(name_first)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 1002, in _parse_table
item = self._parse_item()
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 238, in _parse_item
return self._parse_key_value(True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 334, in _parse_key_value
cws, comment, trail = self._parse_comment_trail()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/tomlkit/parser.py", line 280, in _parse_comment_trail
raise self.parse_error(UnexpectedCharError, c)
pipenv.vendor.tomlkit.exceptions.UnexpectedCharError: Unexpected character: '[' at line 9 col 14
If you check the Pipfile after this command has finished, you will see that pipenv has modified the original contents:
Issue description
During a
pipenv install pyodbc
with a Pipfile that has multiple sources it seems pipenv reorganizes the Pipfile to have all [[sources]] blocks at the top.However, this reordering will fail if the last line is missing a trailing new-line
If you use the following Pipfile:
(note that I am using twice pypi.org, in our case this would be a private registry). Note that this Pipfile should NOT have a trailing newline after the last name = "pypi2" line!
Expected result
Using the above mentioned Pipfile in the statement
`pipenv install --verbose --extra-pip-args "--dry-run" pyodbc
should just work without a problem
Actual result
Executing the statement
`pipenv install --verbose --extra-pip-args "--dry-run" pyodbc
with the above mentioned Pipfile results in the following error:
If you check the Pipfile after this command has finished, you will see that pipenv has modified the original contents:
As you can see, the [packages] section is started right after the name = "pypi2" key-value line (that originally did not have the trailing new-line)
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
See the earlier mentioned Pipfile (note: make sure you remove any trailing newline, e.g. with command
truncate -s -1 Pipfile
) and command to execute.Please run
$ pipenv --support
, and paste the results here. Don't put backticks (`
) around it! The output already contains Markdown formatting.$ pipenv --support
Pipenv version:
'2024.0.2'
Pipenv location:
'/usr/local/lib/python3.11/site-packages/pipenv'
Python location:
'/usr/local/bin/python'
OS Name:
'posix'
User pip version:
'24.0'
user Python installations found:
PEP 508 Information:
System environment variables:
PYTHONUNBUFFERED
HOSTNAME
PYTHON_VERSION
PWD
PYTHON_SETUPTOOLS_VERSION
container
HOME
LANG
LS_COLORS
GPG_KEY
https_proxy
TERM
SHLVL
HTTPS_PROXY
HTTP_PROXY
PYTHON_PIP_VERSION
http_proxy
PYTHONDONTWRITEBYTECODE
PYTHON_GET_PIP_SHA256
PYTHON_GET_PIP_URL
PATH
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG
:C.UTF-8
PWD
:/application
Contents of
Pipfile
('/application/Pipfile'):Contents of
Pipfile.lock
('/application/Pipfile.lock'):The text was updated successfully, but these errors were encountered: