Calling subprocess with arguments

Mike Kazantsev mk.fraggod at
Fri Jun 19 17:13:55 CEST 2009

On Fri, 19 Jun 2009 07:55:19 -0700
Tyler Laing <trinioler at> wrote:

> I want to execute this command string: vlc -I rc
> This allows vlc to be controlled via  a remote interface instead of the
> normal gui interface.
> Now, say, I try this from subprocess:
> >>>p=subprocess.Popen('vlc -I rc test.avi'.split(' '), shell=False,
> stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> But I don't get the remote interface. I get the normal gui interface. So
> how do I do it? I've tried passing ['vlc', '-I', 'rc'], I've tried ['-I',
> 'rc'] with executable set to 'vlc'. I've had shell=True, I've had
> shell=False. I've tried all these combinations.
> What am I doing wrong?

Write a simple script:

  #!/usr/bin/env python
  import sys
  open('/tmp/argv', 'w').write(repr(sys.argv))

And replace 'vlc' with a path to this script, then invoke it from a
shell, compare the results.
If it gets the right stuff, try the same with os.environ (prehaps vlc
keeps socket location there, just like ssh/gpg-agents?).

Mike Kazantsev //
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 205 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list