summaryrefslogtreecommitdiff
path: root/lib/python/qmk/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/path.py')
-rw-r--r--lib/python/qmk/path.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py
index dfb8371f84..9b94abbc12 100644
--- a/lib/python/qmk/path.py
+++ b/lib/python/qmk/path.py
@@ -70,9 +70,13 @@ def normpath(path):
class FileType(argparse.FileType):
+ def __init__(self, encoding='UTF-8'):
+ # Use UTF8 by default for stdin
+ return super().__init__(encoding=encoding)
+
def __call__(self, string):
"""normalize and check exists
otherwise magic strings like '-' for stdin resolve to bad paths
"""
norm = normpath(string)
- return super().__call__(norm if norm.exists() else string)
+ return norm if norm.exists() else super().__call__(string)