[Tutor] os.system() problem

Michael Langford mlangford.cs03 at gtalumni.org
Sun Feb 3 19:17:52 CET 2008


Popen may be a better call for what you're trying to do. Some of the
higher numbered popens will give you the stderr stream. The lowered
numbered ones are probably all you need.

http://docs.python.org/lib/node529.html

       --Michael

On Feb 3, 2008 12:54 PM, dave selby <dave6502 at googlemail.com> wrote:
> Hi all,
>
> I am not sure if this is a Python or bash issue :).
>
> In bash if I execute 'motion' with the following ...
>
> dave at dev-machine:~/.kde/share/apps/kmotion$ motion &> /dev/null &
> [1] 10734
> dave at dev-machine:~/.kde/share/apps/kmotion$
>
> I get what I expect, a background job, however if I execute it from
> Python with an os.system ...
>
> os.system('motion &> /dev/null &')
>
> I get tons of output to the BASH shell ...
>
> [0] Processing thread 0 - config file /etc/motion/motion.conf
> [0] Processing config file /etc/motion/motion.1.conf
> [0] Processing config file /etc/motion/motion.2.conf
> [1] Thread is from /etc/motion/motion.1.conf
> [2] Thread is from /etc/motion/motion.2.conf
> [1] Thread started
> [2] Thread started
> [1] File of type 2 saved to: /var/lib/motion/20080203/01/tmp/175253.jpg
> ...etc ...
>
> I just can't work out why this is happening & how to stop it ?. Any ideas ?
>
> Cheers
>
> Dave
>
>
>
> --
>
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com


More information about the Tutor mailing list