Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4455

Troubleshooting • Why i cant launch python script with systemd?

$
0
0
I tried to launch my voice assistant with the start of the rassbery pi 4 using systemd but its faliur

Code:

Apr 12 19:44:24 raspberrypi python3[38693]: Traceback (most recent call last):Apr 12 19:44:24 raspberrypi python3[38693]:   File "/home/vovo/Desktop/project-2/mediaplayer/bublik/media_4.py", line 157, in <module>Apr 12 19:44:24 raspberrypi python3[38693]:     listen()Apr 12 19:44:24 raspberrypi python3[38693]:   File "/home/vovo/Desktop/project-2/mediaplayer/bublik/media_4.py", line 120, in listenApr 12 19:44:24 raspberrypi python3[38693]:     stream = mic.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=8192)Apr 12 19:44:24 raspberrypi python3[38693]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Apr 12 19:44:24 raspberrypi python3[38693]:   File "/home/vovo/Desktop/project-2/mediaplayer/bublik/lib/python3.11/site-packages/pyaudio/__init__.py", line 639, in openApr 12 19:44:24 raspberrypi python3[38693]:     stream = PyAudio.Stream(self, *args, **kwargs)Apr 12 19:44:24 raspberrypi python3[38693]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Apr 12 19:44:24 raspberrypi python3[38693]:   File "/home/vovo/Desktop/project-2/mediaplayer/bublik/lib/python3.11/site-packages/pyaudio/__init__.py", line 441, in __init__Apr 12 19:44:24 raspberrypi python3[38693]:     self._stream = pa.open(**arguments)Apr 12 19:44:24 raspberrypi python3[38693]:                    ^^^^^^^^^^^^^^^^^^^^Apr 12 19:44:24 raspberrypi python3[38693]:     OSError: [Erron -9997] Invalid sample rate
I dont understand why there is an Invalid sample rate because if i launch it mannually it will work
Here is my unit

Code:

#rpi.service [Unit]Description= RPi-ServiceAfter = multi-user.target[Service]Type = simpleEnvironment="DISPLAY=:0"Environment="XAUTHORITY=/home/vovo/.Xauthority"ExecStart = /home/vovo/Desktop/project-2/mediaplayer/bublik/bin/python3 /home/vovo/Desktop/project-2/mediaplayer/bublik/media_4.pyRestart = alwaysRestartSec = 5KillMode = processSendSIGHUP = no[Install]WantedBy= graphical.target

Statistics: Posted by marakas — Sat Apr 13, 2024 12:16 pm — Replies 0 — Views 9



Viewing all articles
Browse latest Browse all 4455

Trending Articles