Command shell access within Python
pieroul at attglobal.net
pieroul at attglobal.net
Sun Nov 4 13:02:46 EST 2001
More information about the Python-list mailing list
Sun Nov 4 13:02:46 EST 2001
- Previous message (by thread): Command shell access within Python
- Next message (by thread): Command shell access within Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am new to Python and i want to execute several shell commands within a Python function. Is there an easy way to execute several shell command lines and get the return code of each of them using a Python library call? Things like os.execv(), os.system() and os.startfile() allow me to execute one command at a time, starting one process for every statement. I also played with the os.popen(), os.popen2(),... These allow to get a pipe to a command shell and issue commands and read the results via stdin, stdout and stderr. But there must be a better way so I can use Python to execute command line programs programmatically using Python the way you would use a command line script. I also need to get the return code (c exit()) of the program that ran. I do not want to start one command shell process for every single command line . Anyone knows how to do it? Thanks Pierre R.
- Previous message (by thread): Command shell access within Python
- Next message (by thread): Command shell access within Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list