From 82f03afc105215aeab2a7da3d9bd7723a4e3c364 Mon Sep 17 00:00:00 2001 From: AN Long Date: Tue, 27 Feb 2024 21:46:36 +0800 Subject: [PATCH] Fix a compatible issue with very old version of Python --- thriftpy2/hook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/thriftpy2/hook.py b/thriftpy2/hook.py index 2ae383b..c48d6f2 100644 --- a/thriftpy2/hook.py +++ b/thriftpy2/hook.py @@ -3,7 +3,6 @@ from __future__ import absolute_import import sys -import importlib.abc import importlib.util import types @@ -15,6 +14,8 @@ # specified thrift file does not exists, it raises FileNotFoundError, and skiped # the other meta finders in the sys.meta_path. if sys.version_info >= (3, 4): + import importlib.abc + class ThriftImporter(importlib.abc.MetaPathFinder): def __init__(self, extension="_thrift"): self.extension = extension