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

Troubleshooting • Re: Cronjob does not run launcher.sh

$
0
0
@SurferTim :

Please stop advising people to use fixed duration sleeps in situations like this. It's an ugly hack and will not work in all cases.

Use a systemd service with appropriate dependencies instead of cron, rc.local, etc.

If you must do it in your python code do something like this:

Code:

import time# using pygame as an example as it throws a similar errorimport pygamewhile True:    try:        pygame.init()    except Exception:        # doesn't trap ctrl-C        time.sleep(1)    else:        break
@Wessiez :

Looks like the error is coming from ffplay not from python.

If your goal is to simply play one video file why are you using both a shell script and a python script when you could just call ffplay -i home/pi/dir/anything.mp4 -loop 0 -fs directly? Though i should probably point out that the post I cut'n'pasted that from is missing the leading "/" before "home".

You may also want to look at some of the other possible methods in my guide.

Lastly, the above example code will not work when using os.system() as os.system() doesn't raise an exception if the called command fails. Instead you need to check the returned exit status of the command or use the subprocess module instead.

Statistics: Posted by thagrol — Tue Nov 05, 2024 2:57 am



Viewing all articles
Browse latest Browse all 3165

Trending Articles