> > Anyway there's a TimedRotatingFileHandler handler in the logging package:
> > you can derive from it and change the emit/doRollover pair to hold the 
> > records
> > until a device is not ready.
>
> Hm, that might be the way to go. Will have a try.

I had another look at the logging package.
The class TimedRotatingFileHandler within the initialisation method
uses the FileHandler.__init__. Whereas the FileHandler.__init__ method
opens the stream in the 'append' mode (mode='a'). If the flash drive
is not available while you start the script, which equals that you
can't open a file in the append mode,  then the
TimedRotatingFileHandler (or FileHandler) fails.
In my opinion the only way to go through this is to use two different
handlers and once the flash drive is available then start to use the
FileHandler.

Still not sure if I want to use separate thread for checking the flash
drive availability. Probably I need to build it this way.

Regards
Krzysztof
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to