Skip to content

Do not raise exception for pipenv graph when virtualenv does not exist #3201

Closed
@jxltom

Description

Issue description

When virutaulenv is not created for a project yet, pipenv graph will raise exception.

➜  pipenv graph
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv', 'console_scripts', 'pipenv')()
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/Documents/dev/pipenv/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/Documents/dev/pipenv/pipenv/cli/command.py", line 538, in graph
    do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)
  File "/home/user/Documents/dev/pipenv/pipenv/core.py", line 2430, in do_graph
    python_path = which("python")
  File "/home/user/Documents/dev/pipenv/pipenv/core.py", line 110, in which
    raise RuntimeError("location not created nor specified")
RuntimeError: location not created nor specified

It happens at least for v2018.10.13.

Expected result

It should be a friendly info.

➜  pipenv graph
Warning: No virtualenv has been created for this project yet! Consider running `pipenv install` first to automatically generate one for you or see`pipenv install --help` for further instructions.

Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

If you're on macOS, run the following:

$ pipenv --support | pbcopy

If you're on Windows, run the following:

> pipenv --support | clip

If you're on Linux, run the following:

$ pipenv --support | xclip

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions