On 08/26/2012 05:57 AM, Don Jennings wrote: > > On Aug 26, 2012, at 12:25 AM, tutor-requ...@python.org > <mailto:tutor-requ...@python.org> wrote: > >> Message: 2 >> Date: Sat, 25 Aug 2012 17:46:08 -0700 >> From: Ray Jones <crawlz...@gmail.com <mailto:crawlz...@gmail.com>> >> To: tutor@python.org <mailto:tutor@python.org> >> Subject: [Tutor] 2.7.3 Popen argument issues >> Message-ID: <503971d0.5040...@gmail.com >> <mailto:503971d0.5040...@gmail.com>> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Is there a method by which I can get an exact representation of command >> line arguments passed by Popen as seen by the called program? The >> argument error I receive shows me an argument that looks exactly like >> the argument that I use with Bash (it should - I copied and pasted it) - >> but the Bash version works while the Python version doesn't. >> >> The purpose is to capture http streaming video to a file and also split >> it out to a local port so that I can pop in and monitor where I am in >> the stream. >> >> Here is my Bash call to vlc (it works): >> >> vlc http://"$HOST":$PORT -I dummy --sout >> '#duplicate{dst="transcode{vb=400}:std{access=file,mux=avi,dst=testing.avi}",dst="std{access=http,mux=mpjpeg,dst=127.0.0.1:11300}"}' > > Notice that the above call ends in a single quote? > >> & >> >> Here is my Python call to vlc (error response to follow): >> >> vlcExec = sp.Popen(['vlc', 'http://' + ip + ':' + port, '-I dummy', >> '--sout >> \'#duplicate{dst="transcode{vb=400}:std{access=file,mux=avi,dst=outFile >> + '.avi}",dst="std{access=http,mux=mpjpeg,dst=127.0.0.1:11300}"}\'']) >> >> (That is not an escaped double quote at the end - that is " \' " and >> " ' "). >> >> Here is the resulting error from vlc: >> >> vlc: unknown option or missing mandatory argument `--sout >> '#duplicate{dst="transcode{vb=400}:std{access=file,mux=avi,dst=testing.avi}",dst="std{access=http,mux=mpjpeg,dst=127.0.0.1:11300}"}'' > > Notice that this one ends in a double quote? Those are **definitely > not** the same :>)
I noticed that too. It took me a while to see why the difference.... Notice that vlc added a backtick before quoting the '--sout' string. That additional quote is the close of the backtick that it used to quote the string. ;)
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor