Re: execute commands and return output

2005-09-10 Thread billiejoex
Thanks for suggestions. I'll try one of these solutions soon. -- http://mail.python.org/mailman/listinfo/python-list

Re: execute commands and return output

2005-09-10 Thread tiissa
billiejoex wrote: > Hi all. I'm searching for a portable (working on *nix and win32) function > that executes a system command and encapsulate its output into a string. > Searching for the web I found this: > > os.popen('command').read() > > It is perfect but when che command return an error the

Re: execute commands and return output

2005-09-10 Thread Leif K-Brooks
billiejoex wrote: > Thank you for your help but I'm searching a different way. > Moreover it doesn't work always (for exaple: try a 'dir' command). > Because of I'm implementing a remote shell the > [[os.popen('command').read()]] rapresents the best for me because it can > also accepts arguments

Re: execute commands and return output

2005-09-10 Thread Fredrik Lundh
"billiejoex" wrote: > Moreover it doesn't work always (for exaple: try a 'dir' command). why use os.system("dir") when Python already offers things like os.listdir, os.walk, and glob.glob ? -- http://mail.python.org/mailman/listinfo/python-list

Re: execute commands and return output

2005-09-10 Thread Do Re Mi chel La Si Do
Hi ! Look (the doc for) Popen2, Popen3, Popen4 & Subprocess @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: execute commands and return output

2005-09-10 Thread billiejoex
Thank you for your help but I'm searching a different way. Moreover it doesn't work always (for exaple: try a 'dir' command). Because of I'm implementing a remote shell the [[os.popen('command').read()]] rapresents the best for me because it can also accepts arguments direclty (for example: os

Re: execute commands and return output

2005-09-10 Thread Fredrik Lundh
"billiejoex" wrote: > Hi all. I'm searching for a portable (working on *nix and win32) function > that executes a system command and encapsulate its > output into a string. > Searching for the web I found this: > > os.popen('command').read() > > It is perfect but when che command return an error

Re: execute commands and return output

2005-09-10 Thread Leif K-Brooks
billiejoex wrote: > Hi all. I'm searching for a portable (working on *nix and win32) function > that executes a system command and encapsulate its output into a string. > Searching for the web I found this: > > os.popen('command').read() > > It is perfect but when che command return an error the