[Twisted-Python] Problem with process ?

Glyph Lefkowitz glyph at divmod.com
Tue Sep 14 06:30:42 MDT 2004


On Tue, 2004-09-14 at 13:58 +0200, Philippe Bouige wrote:
> Hello,

> 
>    But when i change
>    by :
>    return utils.getProcessOutput("ls",["-l *"])   
>    or :
>    return utils.getProcessOutput("ls",["-l -a"])
>    or :
>    return utils.getProcessOutput("ls",["-l ."])
> 
>    and i have allways this error, but I don't undestand ??

Philippe,

Twisted's getProcessOutput doesn't invoke your operating system's shell
to run commands.  When your shell sees "ls -l *" in a directory with the
files "file1 file2 file3", it converts it (through a series of
manipulations described in 'man 1 sh' on your platform) to ['/bin/ls',
'-l', 'file1', 'file2', 'file3'].

If you are really sure that is what you want, you can run
getProcessOutput like this:

utils.getProcessOutput("/bin/sh", ["-c", "ls -l *"])

but I recommend you do some reading up on how your operating system
processes commands first.





More information about the Twisted-Python mailing list