User avatar
Posts: 93
Joined: Sun Sep 22, 2013 9:02 pm
Location: Orrville, OH
Contact: Website

Better than os.start?

Sun Apr 13, 2014 8:26 pm

I'm running a Python script that currently uses an os.system [os.system("randomplay --basedir=/home/pi/music"] to launch an outside player. The script simply stops at that point to do the other job (randomplay).

Is there a better command which will launch the outside job, then continue on running the python script it was launched from while the other application is running?

Edit, I can add a & to the executed line, but then I'm not going to have access to the controls of the player.

Thanks in advance
My Ongoing Raspberry Pi Reference:

User avatar
Posts: 4672
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Better than os.start?

Sun Apr 13, 2014 9:00 pm

Take a look at subprocess.popen()

User avatar
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Better than os.start?

Mon Apr 14, 2014 2:30 am

use the full pathname ie

Code: Select all

 /usr/local/bin/randomplay -args
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:

Return to “Python”