Mercurial > pidgin.yaz
comparison libpurple/purple-remote @ 20735:f267a5b511ed
Better error handling when no libpurple dbus service is detected. This was Etan's suggestion. Fixes #3278.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 02 Oct 2007 02:17:53 +0000 |
parents | b9a6272f4039 |
children | fefe61275687 |
comparison
equal
deleted
inserted
replaced
20734:35a811e99c7d | 20735:f267a5b511ed |
---|---|
7 | 7 |
8 import xml.dom.minidom | 8 import xml.dom.minidom |
9 | 9 |
10 xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName | 10 xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName |
11 | 11 |
12 obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") | 12 obj = None |
13 try: | |
14 obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") | |
15 except: | |
16 pass | |
17 | |
13 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") | 18 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") |
14 | 19 |
15 class CheckedObject: | 20 class CheckedObject: |
16 def __init__(self, obj): | 21 def __init__(self, obj): |
17 self.obj = obj | 22 self.obj = obj |
210 show_help() | 215 show_help() |
211 raise "Unknown command: %s" % command | 216 raise "Unknown command: %s" % command |
212 | 217 |
213 if len(sys.argv) == 1: | 218 if len(sys.argv) == 1: |
214 show_help() | 219 show_help() |
215 | 220 elif (obj == None): |
221 print "No existing libpurple instance detected." | |
222 sys.exit(1); | |
223 | |
216 for arg in sys.argv[1:]: | 224 for arg in sys.argv[1:]: |
217 output = execute(arg) | 225 output = execute(arg) |
218 | 226 |
219 if (output != None): | 227 if (output != None): |
220 print output | 228 print output |