[Tutor] 2.7.3 Popen argument issues

Ray Jones crawlzone at gmail.com
Sun Aug 26 15:01:54 CEST 2012


On 08/26/2012 05:57 AM, Don Jennings wrote:
>
> On Aug 26, 2012, at 12:25 AM, tutor-request at python.org
> <mailto:tutor-request at python.org> wrote:
>
>> Message: 2
>> Date: Sat, 25 Aug 2012 17:46:08 -0700
>> From: Ray Jones <crawlzone at gmail.com <mailto:crawlzone at gmail.com>>
>> To: tutor at python.org <mailto:tutor at python.org>
>> Subject: [Tutor] 2.7.3 Popen argument issues
>> Message-ID: <503971D0.5040609 at gmail.com
>> <mailto:503971D0.5040609 at 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. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120826/0d54900c/attachment.html>


More information about the Tutor mailing list