This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients Arve.Knudsen, exarkun, piotr.dobrogost, r.david.murray, sbt
Date 2013-08-04.13:55:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375624536.33.0.907592090443.issue18649@psf.upfronthosting.co.za>
In-reply-to
Content
Firstly, list2cmdline() takes a list as its argument, not a string:

  >>> import subprocess
  >>> print subprocess.list2cmdline([r'\"1|2\"'])
  \\\"1|2\\\"

But the problem with passing arguments to a batch file is that cmd.exe parses arguments differently from how normal executables do.  In particular, "|" is treated specially and "^" is used as an escape character.

If you define test.bat as

  @echo off
  echo "%1"

then

  subprocess.call(['test.bat', '1^|2'])

prints

  "1|2"

as expected.

This is a duplicate of http://bugs.python.org/issue1300.
History
Date User Action Args
2013-08-04 13:55:36sbtsetrecipients: + sbt, exarkun, r.david.murray, Arve.Knudsen, piotr.dobrogost
2013-08-04 13:55:36sbtsetmessageid: <1375624536.33.0.907592090443.issue18649@psf.upfronthosting.co.za>
2013-08-04 13:55:36sbtlinkissue18649 messages
2013-08-04 13:55:36sbtcreate