1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Keyerror while accessing environment variable in AKS pod

Discussão em 'Python' iniciado por Stack, Outubro 8, 2024.

  1. Stack

    Stack Membro Participativo

    My python script uses environment variables, the environment variables are set by Azure configmap, and there are accessible from pod command prompt, they are also available to python when I run manually on pod command line, but the environment variables are available when the program run on crontab schedule. it fails with the following error.

    Traceback (most recent call last):
    File "/app/fraudblk.py", line 6, in <module>
    from someLib import SomeFunc
    File "/app/someLib .py", line 920, in <module>
    userName = os.environ["CSI_USER"]
    ~~~~~~~~~~^^^^^^^^^^^^
    File "<frozen os>", line 714, in __getitem__
    KeyError: 'CSI_USER'


    Tried with pytho 3.7 Thanks in advance for your help.

    Continue reading...

Compartilhe esta Página