Ich habe einen Dienst für mein RaspBerryPi-Projekt erstellt. Wenn ich ihn starte, passiert nichts. systemctl status sb.service
Gibt Folgendes zurück:
Failed to start RPI-sound board.
Unit entered failed state.
Failed with result 'exit-code'.
jdn.Dienst:
[Unit]
Description=RPI-sound board
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/home/pi/Desktop/RPSB/RpiSoundBoard.sh
User=pi
[Install]
WantedBy=multi-user.target
Die Dateien, die ausgeführt werden sollen, sindhier gehostet. Sie laufen einwandfrei, wenn ich sie selbst ausführe. Wie kann ich mehr Leistung aus meinem Dienst herausholen oder das Problem beheben?
Antwort1
Habe das Problem in gefunden /var/log/syslog
.
Traceback (most recent call last):
File "/home/pi/Desktop/RPSB/soundPlayer.py", line 1, in <module>
from pynput.keyboard import Key, Listener
File "/home/pi/.local/lib/python3.5/site-packages/pynput/__init__.py", line 40, in <module>
from . import keyboard
File "/home/pi/.local/lib/python3.5/site-packages/pynput/keyboard/__init__.py", line 49, in <module>
from ._xorg import KeyCode, Key, Controller, Listener
File "/home/pi/.local/lib/python3.5/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
from pynput._util.xorg import (
File "/home/pi/.local/lib/python3.5/site-packages/pynput/_util/xorg.py", line 40, in <module>
_check()
File "/home/pi/.local/lib/python3.5/site-packages/pynput/_util/xorg.py", line 38, in _check
display = Xlib.display.Display()
File "/home/pi/.local/lib/python3.5/site-packages/Xlib/display.py", line 89, in __init__
self.display = _BaseDisplay(display)
File "/home/pi/.local/lib/python3.5/site-packages/Xlib/display.py", line 71, in __init__
protocol_display.Display.__init__(self, *args, **keys)
File "/home/pi/.local/lib/python3.5/site-packages/Xlib/protocol/display.py", line 84, in __init__
name, protocol, host, displayno, screenno = connect.get_display(display)
File "/home/pi/.local/lib/python3.5/site-packages/Xlib/support/connect.py", line 73, in get_display
return mod.get_display(display)
File "/home/pi/.local/lib/python3.5/site-packages/Xlib/support/unix_connect.py", line 76, in get_display
error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""