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

python's venv activate script errors out #62

Closed
prez opened this issue Sep 15, 2024 · 3 comments
Closed

python's venv activate script errors out #62

prez opened this issue Sep 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@prez
Copy link

prez commented Sep 15, 2024

Describe the bug

. .venv/bin/activate

errors out with

.venv/bin/activate:34: syntax error: the parameter name is missing or invalid
.venv/bin/activate:34: syntax error: `fi' is missing

To Reproduce
Steps to reproduce the behavior:

  1. Create a python venv
  2. Source the activation script

Additional context

I've attached the activate script for your convenience
activate.txt

As this is a very standard workflow for python development, it would be great to have this fixed. Thank you!

@prez prez added the bug Something isn't working label Sep 15, 2024
@magicant
Copy link
Owner

Thank you for opening the issue.

In the script file you attached, the line SCRIPT_PATH="${(%):-%x}" contains a zsh-specific extension that is unlikely to be implemented in yash. Yash is designed to eagerly catch unsupported syntax, even in commands that are not executed, so unfortunately, this cannot be “fixed.”

To resolve this issue, the venv authors should consider rewriting this line to eval 'SCRIPT_PATH="${(%):-%x}"'. This way, the line will only be parsed if it is executed.

@magicant magicant closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2024
@ay-ex
Copy link

ay-ex commented Nov 27, 2024

Same issue over here.
@prez thank you for opening the issue over at uv, did get the activate script to work via patching?
I eval wrapped ZSH and KSH, as described by @magicant , also checked for YASH_VERSION,
but what would be the equivalent for BASH_SOURCE to get the activate script path in yash? 🤔
(with the path hardcoded and OSTYPE set, activate works)

@prez
Copy link
Author

prez commented Nov 29, 2024

@ay-ex No, I haven't attempted to patch it. It'd be nice to get the fix upstream, but in the meantime I'm just using bash to source it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants