Sample Header Ad - 728x90

Systemd + Python Script that runs VLC doesn't allow dbus control access to VLC

1 vote
2 answers
1343 views
OK, this is weird. I have been battling this all day & have been unsuccessful as of yet. I am working on a project that is Python based. The project is started via systemd scripts. Weird thing is vlc/cvlc works to an extent, but there is no dbus control. If I run the python app from the command line, everything works perfectly. Running the app from systemd is the wonkiness. For instance, when it is run with the following code & service script, I can't control vlc with dbus. If I run the python outside of systemd script, I can access the dbus. There is another weird issue that is a side effect of whatever is causing this problem. It will run 1080 vid just fine but not 4k. Try it out with the following & let me know if you can figure it out. I greatly appreciate any & all help. Thanks! PYTHON CODE (testvlc): #!/usr/bin/env python from subprocess import Popen, PIPE import time vid = 'somevideo.mp4' cmd = 'DISPLAY=:0 cvlc -f --no-osd %s -L' % vid Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) while True: print("Hello!") time.sleep(5) SYSTEMD SCRIPT (testvlc.service): [Unit] Description=Test VLC From Python Script [Service] User=user ExecStart=/usr/bin/screen -D -S testvlc -m /home/user/testvlc [Install] WantedBy=multi-user.target
Asked by Rich Johnson (11 rep)
Jun 25, 2020, 01:26 AM
Last activity: Aug 17, 2020, 09:45 PM