I have two script
1. demo.ksh
2. demo.py
in demo.ksh i am exporting variable as
#!/bin/ksh
TEST="Hello"
export TEST
in demo.py I am executing demo.ksh and trying to read exported value as ..
import os
import subprocess
cmd='. demo.ksh' #I even tried 'demo.py' (no .)
subprocess(cmd,shell=True,stdout=subprocess.PIPE)
print(os.getenv('TEST'))
print(os.environ['TEST'])
I am expecting
Hello
Hello
But getting
None
KeyError: 'TEST'
Although it is a simple exercise. I could not find correct solution for this.Please help me what is wrong with my code.