I have a text file contains all the paths belong to bunch of commands that can be called in the bash
scrpits and it is called progs.ini
.
Usually when I want to call this configuration file in my bash script I use this command
. progs.ini
progs.ini contains stuff for instance like this:
BIN=/bin/linux_64/
P_ANALYSE=${BIN}/analyse
NPARA=1
now I want to use some part of my code in python and I was trying to use this command as following:
import subprocess as S
import os
CMD='. progs.ini'
S.call([CMD],shell=True)
It doesn't return any error message but it can not recognise the variables which are defined in progs.ini
>>os.system('echo ${BIN}')
0
Well it is not about setting some environmental variable which is similar to this problem. I want to set some variables using the configuration file.