1

Problems running terminal command via Python

view story
linux-howto

http://stackoverflow.com – I'm working on a small project where I need to control a console player via python. This example command works perfectly on the Linux terminal: mplayer -loop 0 -playlist <(find "/mnt/music/soundtrack" -type f | egrep -i '(\.mp3|\.wav|\.flac|\.ogg|\.avi|\.flv|\.mpeg|\.mpg)'| sort) In Python I'm doing the following: command = """mplayer -loop 0 -playlist <(find "/mnt/music/soundtrack" -type f | egrep -i '(\.mp3|\.wav|\.flac|\.ogg|\.avi|\.flv|\.mpeg|\.mpg)'| sort)""" os.system(command) The problem is when I try it using Python it gives me an error when I run it: sh: 1: Syntax error: (HowTos)