[issue26196] Argparse breaks when a switch is given an argument beginning with a dash

2016-01-25 Thread Charles Daffern
New submission from Charles Daffern: Example code demonstrating the problem: # {{{ import argparse def try_args(*args): parser = argparse.ArgumentParser() parser.add_argument("-a") print("Trying:", args) try: print(parser.parse_args(args))

[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern
Charles Daffern added the comment: >To be sure that it is existing program, you can use shutil.which() I'd like to clear this up a little because this is worded as if shutil.which()'s success implies that the shell will not fail. Here is the setup to demonstrate: >>> im

[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern
Charles Daffern added the comment: In that case, should the documentation specify that shlex.quote is unsuitable for quoting command names? -- ___ Python tracker <http://bugs.python.org/issue26

[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern
Charles Daffern added the comment: It's definitely a corner case (in argv[0] position + is keyword), but here's an example: >>> import subprocess >>> import shlex >>> subprocess.call(shlex.quote("done"), shell=True) /bin/sh: 1: Syntax error: &

[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern
New submission from Charles Daffern: The shlex.quote and pipes.quote functions do not quote shell keywords. Example shell keywords: done, time, coproc, while Presumably the intent of the quote functions is to prevent the resulting string from altering the syntax of the script it is inserted