Message201614
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 |
|
Date |
User |
Action |
Args |
2013-10-29 09:43:13 | telmich | set | recipients:
+ telmich |
2013-10-29 09:43:13 | telmich | set | messageid: <1383039793.25.0.714624843985.issue19430@psf.upfronthosting.co.za> |
2013-10-29 09:43:13 | telmich | link | issue19430 messages |
2013-10-29 09:43:12 | telmich | create | |
|