How, in Python, can I execute a string as a shell command?
You should use the 'call' function of the 'subprocess' module. You can
either pass it a string with the full command or a list of strings
comprising the command (like execv in libc). You must pass the
'shell=True' option if you are
In article mailman.19336.1397098937.10748.gnu-misc-disc...@gnu.org,
Richard Stallman r...@gnu.org wrote:
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to
* Richard Stallman:
How, in Python, can I execute a string as a shell command?
This is often an extremely bad idea because it results in shell
command injection vulnerabilities. Instead of os.system(), use the
subprocess module, which keeps the argument list separate and does not
involve the
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Thanks.
--
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
How, in Python, can I execute a string as a shell command?
--
Dr Richard Stallman