[Tutor] Popen was deprecated since Python 2.6, now what?

Ken G. beachkidken at gmail.com
Mon Feb 16 22:26:17 CET 2015


Wow, just found out this morning that the following
terms of:

import os
pr = os.popen("lpr", "w")
pr.write(month), pr.write(" "),
pr.write("\t\tLine ")

was deprecated. In place there of, there is
a subprocess to use.

I have not been able to figure out on how to use a
subprocess in place of my former popen. I have been
reading the new materials on the subprocess  all day
and it is still not quite understandable.

Is there an easy tutorial of how to replace popen
with the subprocess?

I am using Python 2.7.6 on an Ubuntu 14.04.1 system.

In advance, thanking you all for your assistance.

Ken



More information about the Tutor mailing list