Re: [Pythonmac-SIG] Escaping commandline strings

2011-01-04 Thread Chris Weisiger
On Tue, Jan 4, 2011 at 1:56 PM, Ned Deily wrote: > In article > , > Chris Weisiger wrote: > > I want to sanitize some strings (e.g. escape apostrophes, spaces, etc.) > > before passing them to the commandline via subprocess. Unfortunately I > can't > > seem to find any built-in function to do t

Re: [Pythonmac-SIG] Escaping commandline strings

2011-01-04 Thread Ned Deily
In article , Chris Weisiger wrote: > I want to sanitize some strings (e.g. escape apostrophes, spaces, etc.) > before passing them to the commandline via subprocess. Unfortunately I can't > seem to find any built-in function to do this. Am I really going to have to > write up my own sanitizer? N

Re: [Pythonmac-SIG] Escaping commandline strings

2011-01-04 Thread Chris Weisiger
A friend just pointed me to pipes.quote(). Is there any reason I shouldn't just use that? And given the number of rather simple things that are already in the standard library (e.g. capitalize the first letter of a string), simplicity isn't really an excuse for excluding this functionality. Especi

Re: [Pythonmac-SIG] Escaping commandline strings

2011-01-04 Thread Cameron Simpson
On 04Jan2011 12:21, Chris Weisiger wrote: | I want to sanitize some strings (e.g. escape apostrophes, spaces, etc.) | before passing them to the commandline via subprocess. Unfortunately I can't | seem to find any built-in function to do this. Am I really going to have to | write up my own sanitiz