examples: python: print into stderr

https://mail.gnome.org/archives/networkmanager-list/2015-March/msg00024.html

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
This commit is contained in:
Petr Vorel
2015-03-10 06:18:10 +01:00
committed by Thomas Haller
parent 2171084378
commit 4213c17b44
5 changed files with 5 additions and 5 deletions

View File

@@ -69,7 +69,7 @@ def added_cb(client, result, data):
client.add_connection_finish(result)
print("The connection profile has been succesfully added to NetworkManager.")
except Exception, e:
print("Error: %s" % e)
sys.stderr.write("Error: %s\n" % e)
main_loop.quit()
if __name__ == "__main__":

View File

@@ -77,5 +77,5 @@ if __name__ == "__main__":
client.deactivate_connection(ac, None)
sys.stdout.write("\033[32m -> succeeded\033[0m\n")
except Exception, e:
sys.stdout.write("\033[31m -> failed\033[0m (%s)\n" % e.message)
sys.stderr.write("\033[31m -> failed\033[0m (%s)\n" % e.message)

View File

@@ -75,5 +75,5 @@ if __name__ == "__main__":
print("'%s' zone set to '%s'") % (c.get_id(), new_zone)
break
if not found:
print ("Error: connection '%s' not found.") % (con_name)
sys.stderr.write("Error: connection '%s' not found.\n") % (con_name)
main_loop.quit()

View File

@@ -80,6 +80,6 @@ if __name__ == "__main__":
c.commit_changes(True, None)
print("The connection profile has been updated.")
except Exception, e:
print("Error: %s" % e)
sys.stderr.write("Error: %s\n" % e)
break