Skip to content

Question on running within a python service #2

Description

@dshookowsky

I'm attempting to use this to turn on a monitor when a Passive Infrared sensor detects movement. This code works when run interactively (however the screen won't actually go to sleep on it's own, I had to test it by using xset over SSH). When I run it as a service, I get "Cannot open display".

What needs to be done to access the display as a service running as root?

2015-06-28 20:33:47,765 INFO Waking from sleep
2015-06-28 20:33:47,771 ERROR Traceback (most recent call last):
2015-06-28 20:33:47,773 ERROR File "/usr/local/bin/pir/pir.py", line 51, in MOTION
2015-06-28 20:33:47,775 ERROR d = dpms.DPMS(":0") # to use the current display, or alternatively DPMS(":1")
2015-06-28 20:33:47,777 ERROR Exception
2015-06-28 20:33:47,779 ERROR :
2015-06-28 20:33:47,781 ERROR Cannot open display

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions