Shell quoting as part of the standard library?
David M. Wilson
dw-google.com at botanicus.net
Sat Dec 13 23:39:52 CET 2003
Hello fellow users!
I've been using Python in a couple of different environments for a few
years now. I have quite often found that I have needed to deal with
filenames which may contain characters that confuse the UNIX shell
(space and double quote in particular).
Quite a while ago I came up with two simple functions which allowed me
to safely build a shell command line quickly. I've used the functions
hundreds of times by now, and find myself constantly cut/pasting them
into new projects. It is very likely that someone other than myself
would find these functions to be useful, and I was wondering if such a
thing might find a home in the standard library.
Does this sort of thing have a home in the standard library? It
doesn't really apply across platforms, which is my only real concern.
Where should it be added to? shutil?
If you are thinking of commenting on the way shell_quote_string always
quotes, regardless of whether it is needed, please don't. If it acted
in a more human-friendly manner then it would be called
shell_friendly_quote_string, or something even more insane than that.
More information about the Python-list