Hello. I have a problem with Pants in 2.13.0 when ...
# general
f
Hello. I have a problem with Pants in 2.13.0 when I try to use
.env
file and get the values with
python-dotenv
. Here is a quick example:
Copy code
import os
from dotenv import load_dotenv

load_dotenv()

if __name__ == "__main__":
    print(os.environ["ENVVAR"])
I have a
.env
file with
ENVVAR=test
. When I
run
using Pants 2.12.0 it prints
"test"
without problem but I get this in Pants 2.13.0:
Copy code
File "/tmp/pants-sandbox-9ZiWSR/tasks/helloworld/main.py", line 7, in <module>
    print(os.environ["ENVVAR"])
  File "/home/soheil/.pyenv/versions/3.10.6/lib/python3.10/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'ENVVAR'
Any recommendation?