Re: output to console and to multiple files

2007-02-16 Thread Fuzzyman
On Feb 16, 11:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Feb 16, 4:07 pm, [EMAIL PROTECTED] wrote: > > > > > On Feb 16, 3:28 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > That's ok inside the same process, but the OP needs to use it "from a > > > subprocess or spawn". >

Re: output to console and to multiple files

2007-02-16 Thread [EMAIL PROTECTED]
On Feb 16, 4:07 pm, [EMAIL PROTECTED] wrote: > On Feb 16, 3:28 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > That's ok inside the same process, but the OP needs to use it "from a > > subprocess or spawn". > > You have to use something like tee, working with real file handles. > > I'm

Re: output to console and to multiple files

2007-02-16 Thread garrickp
On Feb 16, 3:28 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > That's ok inside the same process, but the OP needs to use it "from a > subprocess or spawn". > You have to use something like tee, working with real file handles. > I'm not particularly familiar with this, but it seems to me

Re: output to console and to multiple files

2007-02-16 Thread Gabriel Genellina
En Fri, 16 Feb 2007 14:04:33 -0300, Bart Ogryczak <[EMAIL PROTECTED]> escribió: > On Feb 14, 11:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> I'm looking for a way to output stdout/stderr (from a subprocess or >> spawn) to screen and to at least two different files. > > I'd derive

Re: output to console and to multiple files

2007-02-16 Thread Bart Ogryczak
On Feb 14, 11:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I searched on Google and in this Google Group, but did not find any > solution to my problem. > > I'm looking for a way to output stdout/stderr (from a subprocess or > spawn) to screen and to at least two different fil

Re: output to console and to multiple files

2007-02-16 Thread [EMAIL PROTECTED]
On Feb 15, 5:48 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 15 Feb 2007 19:35:10 -0300, Matimus <[EMAIL PROTECTED]> escribió: > > > > >> I think you should be able to use my or goodwolf's solution with the > >> subprocess module. Something like this (untested): > > >> [code] > >> c

Re: output to console and to multiple files

2007-02-15 Thread Gabriel Genellina
En Thu, 15 Feb 2007 19:35:10 -0300, Matimus <[EMAIL PROTECTED]> escribió: >> I think you should be able to use my or goodwolf's solution with the >> subprocess module. Something like this (untested): >> >> [code] >> class TeeFile(object): >> def __init__(self,*files): >> self.files = f

Re: output to console and to multiple files

2007-02-15 Thread Matimus
On Feb 15, 8:51 am, "Matimus" <[EMAIL PROTECTED]> wrote: > On Feb 15, 7:53 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > On Feb 14, 5:10 pm, "goodwolf" <[EMAIL PROTECTED]> wrote: > > > > like this? > > > > class Writers (object): > > > > def __init__(self, *writers): > > >

Re: output to console and to multiple files

2007-02-15 Thread Matimus
On Feb 15, 7:53 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Feb 14, 5:10 pm, "goodwolf" <[EMAIL PROTECTED]> wrote: > > > > > like this? > > > class Writers (object): > > > def __init__(self, *writers): > > self.writers = writers > > > def write(self, string): > >

Re: output to console and to multiple files

2007-02-15 Thread [EMAIL PROTECTED]
On Feb 14, 6:52 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 14 Feb 2007 19:28:34 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribió: > > > I'm looking for a way to output stdout/stderr (from a subprocess or > > spawn) to screen and to at least two different files. > > Look at

Re: output to console and to multiple files

2007-02-15 Thread [EMAIL PROTECTED]
On Feb 14, 5:10 pm, "goodwolf" <[EMAIL PROTECTED]> wrote: > like this? > > class Writers (object): > > def __init__(self, *writers): > self.writers = writers > > def write(self, string): > for w in self.writers: > w.write(string) > > def flush(self): >

Re: output to console and to multiple files

2007-02-14 Thread Gabriel Genellina
En Wed, 14 Feb 2007 19:28:34 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I'm looking for a way to output stdout/stderr (from a subprocess or > spawn) to screen and to at least two different files. Look at the tee command. If you control the subprocess, and it's written in Python,

Re: output to console and to multiple files

2007-02-14 Thread goodwolf
like this? class Writers (object): def __init__(self, *writers): self.writers = writers def write(self, string): for w in self.writers: w.write(string) def flush(self): for w in self.writers: w.flush(): import sys logfile = open('log

Re: output to console and to multiple files

2007-02-14 Thread Matimus
I took a look around and I couldn't find anything either. I will be keeping an eye on this thread to see if someone posts a more standard solution. In the mean time though, I will offer up a potential solution. Duck typing is your friend. If you are only using the write method of your files, it can

output to console and to multiple files

2007-02-14 Thread [EMAIL PROTECTED]
Hello, I searched on Google and in this Google Group, but did not find any solution to my problem. I'm looking for a way to output stdout/stderr (from a subprocess or spawn) to screen and to at least two different files. eg. stdout/stderr -> screen stdout -> log.out stderr -> log.err and if pos