[issue15874] argparse cannot parse shell variable arguments in file-given arguments

2012-09-10 Thread Nat Hillard
Nat Hillard added the comment: Thank you, everyone. Defining a new type for this is just what I needed. No additional modifications are necessary on top of this new type. -- resolution: - works for me status: open - closed ___ Python tracker

[issue15874] argparse cannot parse shell variable arguments in file-given arguments

2012-09-07 Thread Steven Bethard
Steven Bethard added the comment: You could try declaring a type converter and using the type= parameter of add_argument. Your type converter could look something like: def expanded_path(arg): return os.path.expandvars(arg) Would that work? --

[issue15874] argparse cannot parse shell variable arguments in file-given arguments

2012-09-07 Thread R. David Murray
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

[issue15874] argparse cannot parse shell variable arguments in file-given arguments

2012-09-06 Thread Nat Hillard
Nat Hillard added the comment: Indeed these are all valid points, and as a zsh user myself I certainly considered the alternative shell issue. That said, if it were at all possible, through a combination of os.environ / shlex, subprocess, and even `source` if necessary, to offload this