Skip to content

Newlines in output of --py #5969

@notEvil

Description

@notEvil

Issue description

pipenv --py adds newlines. For instance
python -c "import subprocess; print(subprocess.Popen(['pipenv', '--py'], stdout=subprocess.PIPE).stdout.read())"

Expected result

should print something like b'/home/user/.local/share/virtualenvs/name-hash/bin/python\n'

Actual result

but actually prints things like b'/home/user/.local/share/virtualenvs/name-hash/bin/p\nython\n'. This is due to

console.print(project._which("python", allow_global=system))

Steps to replicate

  • make the console small enough so the path doesn't fit on one line
  • run python -c "import subprocess; print(subprocess.Popen(['pipenv', '--py'], stdout=subprocess.PIPE).stdout.read())"

This is an issue if run as part of a script or application, for instance here. Maybe add the argument bare similar to

def do_where(project, virtualenv=False, bare=True):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions