summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/__init__.py5
-rw-r--r--portato/listener.py13
2 files changed, 13 insertions, 5 deletions
diff --git a/portato/__init__.py b/portato/__init__.py
index 433c89a..74145e7 100644
--- a/portato/__init__.py
+++ b/portato/__init__.py
@@ -126,4 +126,7 @@ def start():
get_listener().close()
lt.join()
- mq.remove()
+ try:
+ mq.remove()
+ except ipc.MessageQueueRemovedError:
+ debug("MessageQueue already removed. Ignore.")
diff --git a/portato/listener.py b/portato/listener.py
index aa9e31d..c96b637 100644
--- a/portato/listener.py
+++ b/portato/listener.py
@@ -21,7 +21,8 @@ except ImportError:
pynotify = None
from .constants import APP
-from .helper import debug, warning
+from .helper import debug, warning, error
+from . import ipc
class Listener (object):
"""This class handles the communication between the "listener" and the GUI.
@@ -52,6 +53,9 @@ class Listener (object):
except KeyboardInterrupt:
debug("Got KeyboardInterrupt. Aborting.")
break
+ except ipc.MessageQueueRemovedError:
+ debug("MessageQueue removed. Aborting.")
+ break
self.mq = None
@@ -81,12 +85,13 @@ class Listener (object):
warning(_("Listener has not been started."))
self.mq = None
else:
- from . import ipc
-
self.mq = ipc.MessageQueue(mq)
def __send (self, string):
- self.mq.send(string)
+ try:
+ self.mq.send(string)
+ except ipc.MessageQueueError, e:
+ error(_("An exception occured while accessing the message queue: %s"), e)
def send_notify (self, base = "", descr = "", icon = "", urgency = None):
if self.mq is None: