[PyQt] Converting an ugly path to a shell path

Sybren A. Stüvel sybren at stuvel.eu
Tue Sep 14 17:50:41 BST 2010


On Tuesday 14 September 2010 18:40:38 AmFreak at web.de wrote:
> 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 ?

Yep, you can use the shlex module for that. But - only if you actually 
_know_ what the command is, and what its arguments are. For example, 
how would you know that the user isn't trying to run the "ls 
/home/usr/test" executable and pass it "dir/" as the first argument?

-- 
Sybren A. Stüvel

sybren at stuvel.eu
http://stuvel.eu/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100914/cfe9d469/attachment.pgp>


More information about the PyQt mailing list