python: make dbus, gi examples, and debug-helper.py python3 ready

https://bugzilla.gnome.org/show_bug.cgi?id=791121
This commit is contained in:
Yifan J
2017-12-02 12:44:50 +08:00
committed by Thomas Haller
parent 5e239d2c04
commit 797d9c4403
25 changed files with 104 additions and 104 deletions

View File

@@ -37,16 +37,16 @@ def change_secrets_in_one_setting(proxy, config, setting_name):
# returns a dict of dicts mapping name::setting, where setting is a dict
# mapping key::value. Each member of the 'setting' dict is a secret
secrets = proxy.GetSecrets(setting_name)
print "Current secrets:", secrets
print("Current secrets:" + secrets)
# Ask user for new secrets and put them into our connection config
for setting in secrets:
for key in secrets[setting]:
new_secret = raw_input ("Enter new secret for '%s' in '%s': " % (key, setting))
config[setting_name][key] = new_secret
except Exception, e:
except Exception as e:
#code = str(e).split(':')[0]
#print "Exception:", str(e)
#print("Exception:" + str(e))
pass
def change_secrets(con_path, config):
@@ -76,7 +76,7 @@ def find_connection(name):
connection = dbus.Interface(con_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
try:
config = connection.GetSettings()
except Exception, e:
except Exception as e:
pass
# Find connection by the id
@@ -101,7 +101,7 @@ if len(sys.argv) != 2:
# Find the connection
con = find_connection(sys.argv[1])
print "Connection found: ", con_path
print("Connection found: " + con_path)
if con:
# Obtain new secrets and put then into connection dict