1

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.

MaKaNu
  • 762
  • 8
  • 25
  • Ok I found the information in the wiki to unset PS1. But do not really understand for what PS1 is needed, maybe this can be awnsered. – MaKaNu Jan 12 '22 at 15:09
  • What error do you get? `activate` does little more than try to prepend the name of the virtual environment to your current value of `PS1`. It may be doing so in a way that `starship` (whatever that is) doesn't react well with. – chepner Jan 12 '22 at 15:14
  • starship is a promt (kind of compareable to powerlevel10k but works in most shells) I edit the Post and append the error message I got without unset PS1. – MaKaNu Jan 13 '22 at 13:33

1 Answers1

0

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.

Esteis
  • 4,669
  • 2
  • 29
  • 45