Get LINUX env variable with python -
i have ~/.bashrc file:
path=$path:/usr/pgsql-9.3/bin/ db_user=postgres db_password=password db_host=localhost
when i'm doing os.environ['path'] :
/usr/local/sbin
but when i'm doing os.environ['db_user'] get:
keyerror: 'db_user'
how need declare vars correctly python, cause echo in shell :
echo $db_user >>> postgres
thanx
you haven't exported variables:
export db_user=postgres export db_password=password export db_host=localhost
Comments
Post a Comment