Why is the variable PS1 a problem for direnv when sourcing venv

549 Views Asked by At

I use direnv v2.21.2 and want that the hook activates my previous created .venv. If I use just source .venv/bin/activate my environment gets activated, but PS1 reacts with an error message. I actually have no clue what to do with the PS1 variable but it seems not a big issue since I use starshipas my prompt. Not completly shure.

Using instead layout python3 works fine without error but creates the extra venv which I don't need. Any Ideas?

EDIT: The Error Message which is produced by direnv if unset PS1 is not used:

direnv: PS1 cannot be exported. For more information see https://github.com/direnv/direnv/wiki/PS1

The Message leads actually to the correct information, but doesn't help much about why the problem exist.

1

There are 1 best solutions below

0
Esteis On

It seems exporting PS1 triggered a bug in Bash 3.0, and direnv did not have a way to set certain variable instead of exporting them. I don't know what bug in Bash was triggered exactly.