You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recognized, that my Variables are available with poetry run. But if I use poetry shell the variables are still using the variables I specified global.
poetry shell should also override the variables.
The text was updated successfully, but these errors were encountered:
@MaKaNu After try a lot, I found that poetry shell was able to override variables in Windows.
Bash/Zsh/Fish in ubuntu/centos/MacOS are able to reproduce, this is because poetry-dotenv-plugin set variables into os.environ before virtual environment activated, and poetry activate virtual environment by pexpect.spawn which will run the shell initial file (such as: .bashrc/.zshrc/.profile) that specified global variables again.
One solution is to send export command into interactive environment:
# Add the following lines to `~/.local/share/pipx/venvs/poetry/lib/python3.10/site-packages/poetry/utils/shell.py`importdotenvifvariables:=dotenv.dotenv_values(Path.cwd()/'.env').items():
export_cmd=' && '.join(f'export {k}={v!r}'fork, vinvariables)
c.sendline(export_cmd)
I recognized, that my Variables are available with
poetry run
. But if I usepoetry shell
the variables are still using the variables I specified global.poetry shell
should also override the variables.The text was updated successfully, but these errors were encountered: