2

I am trying to run Python script through a wrapper script which sets path to different directories and handle log file & script execution.

While running shell scripts through this wrapper we assign the paths by using ${temp_data_path} in the ksh&bash scripts ,so now I want the same path but in my python script.

I am trying below,as I believe i have to set environment variable first by reading the value set for temp_data_path by my wrapper:

os.environ[temp_data_path] = ??not sure how I can assign the value from wrapper here

print os.environ[temp_data_path]
rkj
  • 671
  • 3
  • 14
  • 25
  • 1
    I'm not sure I understand what exactly you're asking. The name of your shell environment variable is `temp_data_path`, right?. Are you maybe just looking for `print os.environ['temp_data_path']` inside Python? (Note the single quotes) – Lukas Graf Sep 10 '15 at 19:01
  • The wrapper script should set the environment variable, you don't need to assign it in the Python script as well. – Barmar Sep 10 '15 at 19:02
  • Perfect @LukasGraf,it worked like a charm. os.environ["temp_data_path"] assigned the path set by wrapper. – rkj Sep 10 '15 at 19:03
  • Great, glad I could help. I therefore linked an appropriate duplicate, so that we can close the question. – Lukas Graf Sep 10 '15 at 19:05

0 Answers0