Richard Oudkerk added the comment:
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
Piotr Dobrogost added the comment:
I think you're missing the point. The implementation is wrong as it does not do
what documentation says which is A double quotation mark preceded by a
backslash is interpreted as a literal double quotation mark. How the output of
list2cmdline interacts with
R. David Murray added the comment:
This is a only a duplicate of issue 1300 in the sense that that issue points
out that list2cmdline has nothing to do with passing/quoting strings for
cmd.exe.
list2cmdline is an internal function of the subprocess module. Its docstring
documents the MS C
R. David Murray added the comment:
The first line above is incomplete. I meant that issue 1300 is only a
duplicate in the sense that it points out that list2cmdline implements the MS C
quoting rules, *not* the cmd.exe quoting rules.
--
___
Python
Richard Oudkerk added the comment:
I think you're missing the point. The implementation is wrong as it
does not do what documentation says which is A double quotation mark
preceded by a backslash is interpreted as a literal double quotation
mark.
That docstring describes how the string
R. David Murray added the comment:
The list form of Popen should never be used with shell=True.
It would be very good if someone would propose a 'cmd.exe quote' function for
the stdlib.
But both of these points don't have anything to do with this issue, as far as I
can see :)
--
Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18649
___
R. David Murray added the comment:
Using the same rules as the MS C runtime means that, given a sequence (list)
of arguments, create a string that uses the same quoting that the MS C runtime
uses. That is, if you have a sequence of arguments in a C program, and you
want to call another
Piotr Dobrogost added the comment:
The docstring starts with this statement
Translate a sequence of arguments into a command line string, using the same
rules as the MS C runtime:
which clearly makes the impression that function list2cmdline uses the same
rules as the MS C runtime. However
Piotr Dobrogost added the comment:
Sure, something like
The purpose of this function is to construct a string which will be later
interpreted by MS C runtime as denoting a sequence of arguments. Because of
this the string is built in such a way as to preserve the original characters
when
New submission from Piotr Dobrogost:
According to the docstring of list2cmdline function in subprocess module the
sequence of a backslash followed by a double quote mark should denote double
quote mark in the output string. However it's not the case
Python 2.7.4 (default, Apr 6 2013,
11 matches
Mail list logo