I have a bash script that sets an environment variable an runs a command
LD_LIBRARY_PATH=my_path
sqsub -np $1 /homedir/anotherdir/executable
Now I want to use python instead of bash, because I want to compute some of the arguments that I am passing to the command.
I have tried
putenv("LD_LIBRARY_PATH", "my_path")
and
call("export LD_LIBRARY_PATH=my_path")
followed by
call("sqsub -np " + var1 + "/homedir/anotherdir/executable")
but always the program gives up because LD_LIBRARY_PATH is not set.
How can I fix this?
Thanks for help!
(if I export LD_LIBRARY_PATH before calling the python script everything works, but I would like python to determine the path and set the environment variable to the correct value)
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…