diff options
Diffstat (limited to 'highlight.py')
| -rw-r--r-- | highlight.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/highlight.py b/highlight.py index 361a0d2..ffcdd2c 100644 --- a/highlight.py +++ b/highlight.py | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | import sys | 1 | import sys |
| 2 | import json | 2 | import json |
| 3 | import re | 3 | import re |
| 4 | import pathlib | ||
| 4 | from datetime import timedelta | 5 | from datetime import timedelta |
| 5 | 6 | ||
| 6 | # ANSI escape codes for terminal colors | 7 | # ANSI escape codes for terminal colors |
| @@ -100,7 +101,8 @@ def visualize_entry(entry: dict): | |||
| 100 | 101 | ||
| 101 | def main(filepath: str): | 102 | def main(filepath: str): |
| 102 | try: | 103 | try: |
| 103 | with open(filepath, 'r', encoding='utf-8') as f: | 104 | p = pathlib.Path(filepath) |
| 105 | with p.open('r', encoding='utf-8') as f: | ||
| 104 | for line in f: | 106 | for line in f: |
| 105 | try: | 107 | try: |
| 106 | entry = json.loads(line) | 108 | entry = json.loads(line) |
