[issue15874] argparse cannot parse shell variable arguments in file-given arguments
R. David Murray
report at bugs.python.org
Fri Sep 7 18:23:54 CEST 2012
R. David Murray added the comment:
I had forgotten all about os.path.expandvars. Note, however, that that function is very naive:
>>> os.path.expandvars("'$HOME'")
"'/home/rdmurray'"
That is, it is doing unconditional substitution, not parsing shell syntax. It should work well for simple cases, though.
It might be worth throwing up a trial balloon on python-ideas for adding something to shlex that would do a "better" job of environment variable substitution for the version of shell syntax that shlex supports, which would therefore become a sort of platform-independent syntax for doing this.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15874>
_______________________________________
More information about the Python-bugs-list
mailing list