newbie:trying to read in stdoutput of commands under various *nixes
jlenton at gmail.com
Wed Jul 14 13:26:58 CEST 2004
On 13 Jul 2004 23:47:55 -0700, googleboy <mynews44 at yahoo.com> wrote:
> "Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> wrote in message
> <snipped some stuff>
> > import os
> > pin = os.popen("uname", "r")
> > try:
> > print pin.read()
> > finally:
> > pin.close()
> Thanks for the response, Tim. This got me on the right track. What
> I actually needed was to do something like
> sysName = pin.read()
> so that I can compare the value of sysName with the srtong "Linux\n"
> or "OpenBSD\n" and choose to run the rest of my application
> accordingly. (slightly different syntax depending on which system the
> thing I am writing is to run, y'see).
now we've got that out of the way, why don't you use os.uname() ?
John Lenton (jlenton at gmail.com) -- Random fortune:
bash: fortune: command not found
More information about the Python-list