Invalid character in os.system call...

Jeff Epler jepler at unpythonic.net
Sun Mar 21 22:12:04 CET 2004


Python's os.system() is a wrapper around the C library's system() call.
If you read ANSI C, you'll learn that basically nothing about system()
is specified.

In the real world, Unix passes the argument to system() to sh -c, like
so:
    def system(command):
        return os.spawnv(os.P_WAIT, "/bin/sh", ["sh", "-c", command])
so refer to "man sh" to learn more about how the command is interpreted,
or use os.spawnv or os.execv to directly control the list of arguments
in the subprogram.

Personally, I recommend using spawnv or execv over using system.

Jeff




More information about the Python-list mailing list