From be29b547ab63014ad0f956d76c66e7c0a1069cd3 Mon Sep 17 00:00:00 2001 From: Kepner Wu Date: Fri, 7 Sep 2018 15:45:24 +0800 Subject: [PATCH] Matching of absolute path in Windows When we use thriftpy.load(path, ....) function. if the path is absulute path, after urlparse, the scheme is 'c'/'d'/'e', and the judgment here will not be matched. So this change can make the module more friendly to Windows. --- thriftpy/parser/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thriftpy/parser/parser.py b/thriftpy/parser/parser.py index 26c6073..979d227 100644 --- a/thriftpy/parser/parser.py +++ b/thriftpy/parser/parser.py @@ -544,7 +544,7 @@ def parse(path, module_name=None, include_dirs=None, include_dir=None, if url_scheme == 'file': with open(urlparse(path).netloc + urlparse(path).path) as fh: data = fh.read() - elif url_scheme == '': + elif len(url_scheme) <= 1: with open(path) as fh: data = fh.read() elif url_scheme in ('http', 'https'):