do not assume xbacklight is installed
authorRalf Jung <post@ralfj.de>
Sun, 1 Feb 2015 13:41:12 +0000 (14:41 +0100)
committerRalf Jung <post@ralfj.de>
Sun, 1 Feb 2015 13:41:12 +0000 (14:41 +0100)
dsl.py

diff --git a/dsl.py b/dsl.py
index ccd70ced8243f4e71895c6e32afbeeeb809bb00c..13a97f80944dff947f8937de982c99809e84585e 100755 (executable)
--- a/dsl.py
+++ b/dsl.py
@@ -252,9 +252,12 @@ if __name__ == "__main__":
         
         # make sure the internal screen is really, *really* turned on if there is no external screen
         if not hasExternal:
-            backlight = float(subprocess.check_output(["xbacklight", "-get"]).strip())
-            if backlight == 0: # it's completely turned off, we better enable it
-                subprocess.check_call(["xbacklight", "-set", "100"])
+            try:
+                backlight = float(subprocess.check_output(["xbacklight", "-get"]).strip())
+                if backlight == 0: # it's completely turned off, we better enable it
+                    subprocess.check_call(["xbacklight", "-set", "100"])
+            except FileNotFoundError:
+                print("xbacklight has not been found, unable to turn your laptop backlight on.")
     except Exception as e:
         frontend.error(str(e))
         raise