I am attempting to pass a bash environment variable back into my fabric function like this:-
from fabric.api import env
def env_localhost():
"All the environment variables relating to your localhost"
project_home = local('echo $PROJECT_HOME')
print 111, project_home
But it doesn't seem to be able to retrieve the stdout results and assign it to my python project_home
variable. What's the correct way to do this right?
Do it like this:
import os
os.getenv("PATH")
Also:
import os
os.environ['PROJECT_HOME']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With