[PyQt] Converting an ugly path to a shell path

AmFreak at web.de AmFreak at web.de
Mon Sep 13 23:08:40 BST 2010


I think quotes don't work always ?
For example when i have a dir like ""' how do i quote it ?



Am 13.09.2010, 23:42 Uhr, schrieb <projetmbc at club-internet.fr>:

> Have you try to use quotes ?
>
> C.
>
> ========================================
>
> Message du : 13/09/2010
> De : AmFreak at web.de
> A : "pyqt at riverbankcomputing.com" <pyqt at riverbankcomputing.com>
> Copie à :
> Sujet : Re: [PyQt] Converting an ugly path to a shell path
>
>
> Hmm that doesn't work, it only seems to change things like multiple "///"
> to one "/", but doesn't add "\" for special chars.
>
>
>
> Am 13.09.2010, 21:07 Uhr, schrieb Darryl Wallace
> :
>
>>> -----Original Message-----
>>> From: pyqt-bounces at riverbankcomputing.com [mailto:pyqt-
>>> bounces at riverbankcomputing.com] On Behalf Of AmFreak at web.de
>>> Sent: September-13-10 11:19 AM
>>> To: pyqt at riverbankcomputing.com
>>> Subject: [PyQt] Converting an ugly path to a shell path
>>>
>>> Hi,
>>>
>>> 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
>> =
>>> PIPE)
>>>
>>> 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 ?
>>
>> Try, from the os module, os.path.abspath.
>>
>> Darryl
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>


More information about the PyQt mailing list