我为我的 RaspBerryPi 项目创建了一个服务。当我启动它时什么也没发生。systemctl status sb.service
返回以下内容:
Failed to start RPI-sound board.
Unit entered failed state.
Failed with result 'exit-code'.
sb.服务:
[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
它应该运行的文件是托管于此。如果我自己运行它们,它们运行得很好。我怎样才能从我的服务中获得更多输出/或修复这个问题?
答案1
中发现问题/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 ""