- 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.")