Re: /dev/null as a file-like object, or logging to nothing

2007-09-11 Thread [david]
Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Sion Arrowsmith wrote: Torsten Bronger [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch writes: `os.devnull`? Yes, but I wasn't really sure how portable it is, in particular, on Windows. Windows has a NUL: device which behaves

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Sion Arrowsmith
Torsten Bronger [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch writes: `os.devnull`? Yes, but I wasn't really sure how portable it is, in particular, on Windows. Windows has a NUL: device which behaves like /dev/null . os.devnull is a wrapper around whatever the system-provided null device

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Gabriel Genellina
En Sat, 08 Sep 2007 14:42:14 -0300, Torsten Bronger [EMAIL PROTECTED] escribi�: `os.devnull`? Yes, but I wasn't really sure how portable it is, in particular, on Windows. So does open(os.devnull, w).write(Schallalla) work on Windows like on Unix? Yes. os.devnull=='nul' on Windows. --

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Sion Arrowsmith wrote: Torsten Bronger [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch writes: `os.devnull`? Yes, but I wasn't really sure how portable it is, in particular, on Windows. Windows has a NUL: device which behaves like /dev/null . It's not a

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Asun Friere
On Sep 11, 10:22 am, Lawrence D'Oliveiro [EMAIL PROTECTED] central.gen.new_zealand wrote: In message [EMAIL PROTECTED], Sion Arrowsmith wrote: Torsten Bronger [EMAIL PROTECTED] wrote: Windows has a NUL: device which behaves like /dev/null . It's not a device, it's a reserved file name.

/dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Torsten Bronger
Hallöchen! Is there a portable and simply way to direct file-like IO to simply nothing? I try to implement some sort of NullLogging by saying --8---cut here---start-8--- import logging if options.logging: logging.basicConfig(level=logging.DEBUG,

Re: /dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Carsten Haese
On Sat, 2007-09-08 at 18:52 +0200, Torsten Bronger wrote: Hallöchen! Is there a portable and simply way to direct file-like IO to simply nothing? I try to implement some sort of NullLogging by saying --8---cut here---start-8--- import logging if

Re: /dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Sep 2007 18:52:57 +0200, Torsten Bronger wrote: Is there a portable and simply way to direct file-like IO to simply nothing? I try to implement some sort of NullLogging by saying `os.devnull`? Ciao, Marc 'BlackJack' Rintsch --

Re: /dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Torsten Bronger
Hallöchen! Marc 'BlackJack' Rintsch writes: On Sat, 08 Sep 2007 18:52:57 +0200, Torsten Bronger wrote: Is there a portable and simply way to direct file-like IO to simply nothing? I try to implement some sort of NullLogging by saying `os.devnull`? Yes, but I wasn't really sure how

Re: /dev/null as a file-like object, or logging to nothing

2007-09-08 Thread Torsten Bronger
Hallöchen! Carsten Haese writes: On Sat, 2007-09-08 at 18:52 +0200, Torsten Bronger wrote: Is there a portable and simply way to direct file-like IO to simply nothing? [...] [...] This might work: class LogSink(object): def write(self, *args, **kwargs): pass def flush(self,