Message169988
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. |
|
Date |
User |
Action |
Args |
2012-09-07 16:23:54 | r.david.murray | set | recipients:
+ r.david.murray, bethard, ZhuangZi |
2012-09-07 16:23:54 | r.david.murray | set | messageid: <1347035034.57.0.292615354316.issue15874@psf.upfronthosting.co.za> |
2012-09-07 16:23:54 | r.david.murray | link | issue15874 messages |
2012-09-07 16:23:53 | r.david.murray | create | |
|