Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipenv --py might introduce newlines #1005

Closed
notEvil opened this issue Oct 10, 2023 · 11 comments
Closed

pipenv --py might introduce newlines #1005

notEvil opened this issue Oct 10, 2023 · 11 comments
Assignees

Comments

@notEvil
Copy link

notEvil commented Oct 10, 2023

Just fyi: pypa/pipenv#5969
This leads to "Unable to get Python version from interpreter" and therefore broken experience

return child_process.spawnSync('pipenv', ['--py'], { encoding: 'utf8' }).stdout.trim();

@fannheyward
Copy link
Owner

What's your pipenv version? Tested with version 2023.10.3, no newlines.

image

@fannheyward
Copy link
Owner

python -c "import subprocess; print(subprocess.Popen(['pipenv', '--py'], stdout=subprocess.PIPE).stdout.read())" outputs:

b'/Users/fannheyward/src/hello-sonar/.venv/bin/python\n'

@notEvil
Copy link
Author

notEvil commented Oct 10, 2023

As noted in "Steps to replicate": make the console small enough so the path doesn't fit on one line

@fannheyward
Copy link
Owner

But this won't affect to coc-pyright's result, doesn't it?

@notEvil
Copy link
Author

notEvil commented Oct 10, 2023

The newline ends up in pythonPath which leads to issues later on like ENOENT (path doesn't exist) in

https://github.com/microsoft/pyright/blob/f4e309a84cbc12e91063d93dc1ede54d84d54485/packages/pyright-internal/src/common/fullAccessHost.ts#L110C22-L110C22

So the issue is affecting coc-pyright but probably needs to be fixed in Pipenv.

@fannheyward
Copy link
Owner

The newline ends up in pythonPath which leads to issues later on like ENOENT

I still can't get the point.

coc-pyright runs pipenv --py by spawning a child process, trims the output, uses the result as pythonPath. The size of the console window, no matter small or big enough, won't affect the child process result.

image

@notEvil
Copy link
Author

notEvil commented Oct 11, 2023

I see, node unlike python seems to create a barrier so rich, used by Pipenv and responsible for splitting the lines, assumes a width of 80. So use a long dictionary name to reproduce with node.

@fannheyward
Copy link
Owner

use a long dictionary name to reproduce with node

What's this?

@notEvil
Copy link
Author

notEvil commented Oct 11, 2023

I meant directory, sry!

@fannheyward
Copy link
Owner

Closing for now. Thank you for your report.

@notEvil
Copy link
Author

notEvil commented Oct 20, 2023

Just for reference: pypa/pipenv#5971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants