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 telmich
Recipients telmich
Date 2013-10-29.09:43:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383039793.25.0.714624843985.issue19430@psf.upfronthosting.co.za>
In-reply-to
Content
When using argparse and the string \$ occurs on the commandline, it is converted to $. This as definitely wrong and renders argparse useless, if the input needs to be trusted (i.e. defitinely the same as given into it)'

Example code:

import sys 
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('test', nargs='*')
result = parser.parse_args(sys.argv[1:])

print("args = %s" % " ".join(sys.argv))
print("result = %s" % result)

Reproduce problem:

[10:41] bento:~% python3 argparse-test.py ps1  "PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w\$ '"
] \[\]\h\[\]:\w\$ '"args = argparse-test.py ps1 PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w$ '
result = Namespace(test=['ps1', "PS1='[\\t] \\[\\033[1m\\]\\h\\[\\033[0m\\]:\\w$ '"])

[10:40] bento:cdist% python --version
Python 3.3.2
History
Date User Action Args
2013-10-29 09:43:13telmichsetrecipients: + telmich
2013-10-29 09:43:13telmichsetmessageid: <1383039793.25.0.714624843985.issue19430@psf.upfronthosting.co.za>
2013-10-29 09:43:13telmichlinkissue19430 messages
2013-10-29 09:43:12telmichcreate