Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting pipenv internal error while trying to run this command " pipenv lock " with pycharm in mac OS

Tags:

python

pipenv

I am new to python and pipenv. when I run pipenv lock,I got the following error, I have reinstall pipenv and search the error on google but I still can not fix the error. Last time when I opened the projects with pipenv it is ok, why now it is bad? Is there any relationship with oh-my-zsh?

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 527, in _parse_pipfile
    return tomlkit.parse(contents)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/api.py", line 49, in parse
    return Parser(string).parse()
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 146, in parse
    key, value = self._parse_table()
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 958, in _parse_table
    item = self._parse_item()
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 270, in _parse_item
    return self._parse_key_value(True)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 347, in _parse_key_value
    raise self.parse_error(UnexpectedCharError, "=")
** tomlkit.exceptions.UnexpectedCharError: Unexpected character: '=' at line 45 col 16 **

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 456, in loads
    multibackslash)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 678, in load_line
    raise ValueError("Invalid date or number")
ValueError: Invalid date or number

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/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.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 301, in uninstall
    ctx=ctx
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2020, in do_uninstall
    ensure_project(three=three, python=python, pypi_mirror=pypi_mirror)
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 574, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 494, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 394, in ensure_python
    python = project.required_python_version
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 243, in required_python_version
    required = self.parsed_pipfile.get("requires", {}).get(
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 509, in parsed_pipfile
    parsed = self._parse_pipfile(contents)
  File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 531, in _parse_pipfile
    return toml.loads(contents)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 458, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Invalid date or number (line 45 column 1 char 848)``

when I run `pipenv update`, I got the same error
like image 834
Destinage Avatar asked Oct 22 '19 11:10

Destinage


People also ask

How do I activate Pipenv in PyCharm?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), navigate to Tools | Python Integrated Tools, and type the target path in the Path ot Pipenv executable field. After the preparation steps are done, you can use pipenv to create a virtual environment for new or existing projects.

How do I enable Pipenv in Python?

To activate the environment, just navigate to your project directory and use pipenv shell to launch a new shell session or use pipenv run <command> to run a command directly.

What is Pipenv lock?

pipenv lock is used to create a Pipfile. lock, which declares all dependencies (and sub-dependencies) of your project, their latest available versions, and the current hashes for the downloaded files. This ensures repeatable, and most importantly deterministic, builds.

How do you check if I have Pipenv installed?

To see installed packages with Pipenv, you can use the pipenv graph command. The output from this is perhaps more verbose than you'd like, but it does contain everything you need.


1 Answers

Check your Pipfile if there is a typo? I got the same error when the Pipfile has a typo, yours I think it is in line 45

like image 164
as_plus_not_lose Avatar answered Sep 18 '22 06:09

as_plus_not_lose