[Tutor] Popen? or something else

Hugo González Monteverde hugonz-lists at h-lab.net
Wed Dec 22 21:41:14 CET 2004

You may use the 'commands' module, if your subprocess should return 
right away, then you can use:

import commands

mystring = commands.getoutput("dtg")


then mystring should have "2004122212" (and possibly '\n', but you'll 
have to check that out, not sure about your command)in it...

Hope it helps, it sure is quicker than popen (I only use popen if I need 
to keep  reading the output, for a one-time capture, I personally prefer 
the "commands" module...)


Ertl, John wrote:
> Roger,
> I have been doing it the Pythonic way (that is why I have no idea about how
> Popen works) but I need to make sure (the systems guys called me on it)  I
> use the same dtg as everyone else...it is possible (has not happened yet in
> 20 years) it could be set to something else.

More information about the Tutor mailing list