Commit 4e1bde1e authored by Guillaume Seguin's avatar Guillaume Seguin

Catch when dbus is unavailable (#522)

parent 2f32c923
......@@ -35,6 +35,9 @@ elif platform.system() == "Windows":
else:
import dbus
try:
bus = dbus.SessionBus()
def inhibit_sleep(reason):
if inhibit_sleep.handler is None:
bus = dbus.SessionBus()
......@@ -57,6 +60,14 @@ else:
return
inhibit_sleep.handler.UnInhibit(inhibit_sleep.token)
inhibit_sleep.token = None
except dbus.DBusException, e:
print "dbus unavailable:", e.message
def inhibit_sleep(reason):
return
def deinhibit_sleep():
return
try:
import psutil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment