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

Use sys.executable instead of python? #7

Closed
Jeremiah-England opened this issue Feb 20, 2024 · 1 comment · Fixed by #8
Closed

Use sys.executable instead of python? #7

Jeremiah-England opened this issue Feb 20, 2024 · 1 comment · Fixed by #8

Comments

@Jeremiah-England
Copy link

I installed this onto a venv ran into this error:

{'type': 'result', 'message': 'error', 'payload': {'msg': '"/home/jje/.pyenv/shims/python": not in executable format: file format not recognized'}, 'token': None}

But /home/jje/.pyenv/shims/python is executable, so I'm not sure what the issue is.

ls /home/jje/.pyenv/shims/python -l
# -rwxr-xr-x 1 jje jje 176 Sep  8 22:12 /home/jje/.pyenv/shims/python*

Does it need to be a proper binary?

cat /home/jje/.pyenv/shims/python
# #!/usr/bin/env bash
# set -e
# [ -n "$PYENV_DEBUG" ] && set -x
# 
# program="${0##*/}"
# 
# export PYENV_ROOT="/home/jje/.pyenv"
# exec "/usr/share/pyenv/libexec/pyenv" exec "$program" "$@"

But it's not the executable I wanted anyway. I wanted the one from the venv I was calling python -m profilia in. Changing this line got it working the way I needed in my particular case:

-    process.stdin.write(b"-file-exec-file python\n")
+    process.stdin.write(bytes(f"-file-exec-file {sys.executable}\n", encoding="utf-8"))
@itamarst
Copy link
Collaborator

Makes sense, I can do that.

@itamarst itamarst linked a pull request Feb 20, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants