There is a $CONFIG variable which stores the way to some dir on unix. I created following python script to test path variable in unix.
import os
path=os.environ.get('$CONFIG')
if os.path.exists(path) is True:
print '{} path exists'.format(path)
else:
print 'problem'
It gives me an error message:
Traceback (most recent call last):
File "test.py", line 6, in <module>
if os.path.exists(path) is True:
File "/usr/lib64/python2.7/genericpath.py", line 18, in exists
os.stat(path)
Woul you please help me how to correctly define path to unix folder using a variable in python script?
答案 0 :(得分:1)
Remove the $
from the variable and it may work. ($
is used in linux terminal, not in python):
path=os.environ.get('CONFIG')