user376507 user376507 -4 years ago 86
Python Question

Setting environment variable in makefile and reading it from python script does not work

I am setting a environment variable (bash) in makefile and I am executing a python script on the next line in the makefile. However, when I try to read the environment variable in the python script using

I am unable to read the environment variable. What is the best way to achieve this?

Answer Source

You need to export it in the same line:

        export FOO=bar; python /the/


        export FOO=bar; \
        python /the/
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download