Regression 2018-11-14 when using --pre flag with particular Pipfile syntax | TypeError: list indices must be integers or slices, not tuple
See original GitHub issueIssue description
I started getting the following error when attempting to use pipenv versions 2018-11-14 (still exists in 2018-11-26) when installing with the --pre flag: pipenv install --pre
.
Expected result
Pipenv installs packages.
Actual result
Pipenv fails with TypeError (this is with the --verbose flag)
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli/command.py", line 254, in install
editable_packages=state.installstate.editables,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1862, in do_install
project.update_settings({"allow_prereleases": pre})
File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 583, in update_settings
p["pipenv"] = settings
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/tomlkit/container.py", line 524, in __setitem__
self.append(key, value)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/tomlkit/container.py", line 176, in append
return self._insert_after(key_after, key, item)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/tomlkit/container.py", line 246, in _insert_after
current_item = self._body[idx][1]
TypeError: list indices must be integers or slices, not tuple
Steps to replicate
- Ensure pipenv version 2018-11-26 is installed.
- Run
pipenv install --pre
- Observe TypeError
Support diagnostics file available upon request.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
TypeError: list indices must be integers or slices not tuple
Conclusion # The Python "TypeError: list indices must be integers or slices, not tuple" occurs when we pass a tuple between the square...
Read more >Python error TypeError: list indices must be integers or slices ...
after removing the end bracket which is making the compiler to think it as a tuple instead of integer. Apply same to id_ratings...
Read more >Python TypeError: list indices must be integers, not tuple
The “TypeError: list indices must be integers, not tuple” error occurs when you specify a tuple as an index value at the end...
Read more >TypeError list indices must be integers or slices not tuple
Have you had a list of lists and received the TypeError list indices must be integers or slices not tuple when trying to...
Read more >Python error: list indices must be integers or slices, not a tuple
The python programming language is very easy to learn. It has easy-to-understand and straightforward syntax that makes it easy to understand for everyone....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The root cause:
The workaround is to combine the packages section in one place, and I pushed a PR to the upstream https://github.com/sdispater/tomlkit/pull/34 to fix this.
@techalchemy The fix has been in tomlkit’s master but not released yet. Since this issue is corner case and has a workaround available, i’ll update the vendor after the upstream is released.
BTW This toml is allowed by spec