Converting an ugly path to a shell path

AmFreak at AmFreak at
Tue Sep 14 01:07:48 CEST 2010


im using a QFileDialog to let the user select a path that is used later in  
a command send to the shell like this:

retcode = Popen(command + " " + path, shell=True, stdout = PIPE, stderr =  

The problem that occurs now is when the user selects an "ugly" path like  
this /home/user/!" §$/.
The shell don't understand the special chars so i have to escape them with  
"\" .
Is there a function that does this ?
If there isn't i would use a RegEx but I can't even seem to find a list  
containing all special chars :/



More information about the Python-list mailing list