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 like /dev/null . > > It's not a device, it's a reserved file name. Or rather, a reserved file > name prefix: any attempt to open a file name beginning with NUL, e.g. > NUL.DAT, will cause your output to disappear into a black hole. > > This has bitten Windows users more than once.
copy myfile to NULL copy myfile to NULfilename copy myfile to NULprefix.txt All work correctly creating files. "Prefix" and "beginning with" are a bit misleading, only a problem with file name NUL(.extension) (not case sensitive unless case sensitive property is enabled) Not sure why you are calling it a reserved file name instead of device, did not used to be, but many years since I looked. Of course 'reserved file name' is a bit misleading: you wouldn't copy bits to a reserved file name. Note NUL device used to be very very slow, again, years since I looked. -- http://mail.python.org/mailman/listinfo/python-list