Re: what is the 256 on my screen ?

Tim Peters (tim@ksr.com)
Thu, 02 Jul 92 16:53:07 -0400

> i did an os.system() call and I keep getting thsse 256 or 0 on my
> screen after the call . Is there anyway to nullify this output ?
>
> i am starting up a faq for python by the way

Well, since Python isn't Perl, when it does something you didn't expect
you can bet it did it for a rational reason <grin>.

Specifically, os.system(some_cmd) returns the exit status of `some_cmd',
and Python always prints the value of a statement that consists in its
entirety of a raw expression. So the line

os.system(some_cmd)

will always print the exit status of some_cmd, for exactly the same
reason that the line

1+2

prints "3". Try, e.g.,

suppress_printing_exit_status = os.system(some_cmd)

That won't print the exit status, & for the same reason that

a = 1+2

won't print "3".

Was that pedantic enough <grin>?

there's-always-a-sensible-method-to-guido's-fine-madness-ly y'rs - tim

Tim Peters Kendall Square Research Corp
tim@ksr.com, ksr!tim@uunet.uu.net