file = open('/tmp/dbus-info') raw = file.read() temp = raw.split('\n') temp2= temp[0].split('=',1) os.environ[temp2[0]] = temp2[1]