[PyQt] Converting an ugly path to a shell path

AmFreak at web.de AmFreak at web.de
Tue Sep 14 17:40:38 BST 2010


Am 14.09.2010, 08:08 Uhr, schrieb Sybren A. Stüvel <sybren at stuvel.eu>:

> On Tuesday 14 September 2010 00:08:40 AmFreak at web.de wrote:
>> I think quotes don't work always ?
>> For example when i have a dir like ""' how do i quote it ?
>
> I would take out the middle man. Don't use the shell, unless you
> really have to. If you just pass a list of arguments to
> subprocess.Popen, they will be "received" by the application just as-
> is. No escaping needed.
>
> import subprocess
> proc = subprocess.Popen([command, path])
>

My problem is that i also have commands that are together with paths so  
cmd = "ls /home/user/test dir/".
And afaik if i don't use the shell i need to seperate command and path ?


More information about the PyQt mailing list