1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Set bash environment variable from python script

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am running 4 Python scripts which in short should set environment variables.

    Point is, using os.environ['TEST'] (say) sets it only for the scope of the Python script that is running it.

    $ python test.py arg1
    $ echo $TEST < ------------


    This returns blank. Whereas printing from within the Python script shows a value in TEST

    os.environ.get('TEST')


    How does one set environment variables from python script?

    As a workaround to put it another way, (alternate question) how does one share data between Python scripts?

    Continue reading...

Compartilhe esta Página