fix imports for write_to_log
specify bare except
remove cir from import and other cleanup