Skip to content

Commit f3750c7

Browse files
author
Kareem Zidane
committed
handle no root logger handlers
1 parent a80dfeb commit f3750c7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cs50/cs50.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
# Configure default logging handler and formatter
1616
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.DEBUG)
1717

18-
# Patch formatException
19-
logging.root.handlers[0].formatter.formatException = lambda exc_info: _formatException(*exc_info)
18+
try:
19+
# Patch formatException
20+
logging.root.handlers[0].formatter.formatException = lambda exc_info: _formatException(*exc_info)
21+
except IndexError:
22+
pass
2023

2124

2225
class _flushfile():

0 commit comments

Comments
 (0)