Problem getting ROS environment variables with python
I'm trying to get the environment variables ROS_MASTER_URI ,ROS_IP and ROS_HOSTNAME with a python script to show it in some information screen for the user. When I open a terminal and echo myself them I get the expected result. But when I do the same with the script I don't get any values like they were not set at all. I tried these ways already:
print(os.environ.get("ROS_MASTER_URI"))
proc = subprocess.Popen('echo "$ROS_MASTER_URI"',shell=True, universal_newlines=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE, executable="/bin/bash")
print(os.environ)
Does anyone know why this is not working as expected ? I'm using python version 3.5 and my ros version is kinetic on an ubuntu 16.04