From 7b4a466ea448d8d9addfe9409ef32d61d447731f Mon Sep 17 00:00:00 2001 From: SunAhong1993 <48579383+SunAhong1993@users.noreply.github.com> Date: Mon, 8 Jul 2019 16:16:51 +0800 Subject: [PATCH] Update resolver.py --- caffe2fluid/kaffe/caffe/resolver.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/caffe2fluid/kaffe/caffe/resolver.py b/caffe2fluid/kaffe/caffe/resolver.py index e67be41..4ff3a9d 100644 --- a/caffe2fluid/kaffe/caffe/resolver.py +++ b/caffe2fluid/kaffe/caffe/resolver.py @@ -6,14 +6,20 @@ SHARED_CAFFE_RESOLVER = None def import_caffepb(): - p = os.path.realpath(__file__) + p = os.path.realpath(__file__) p = os.path.dirname(p) p = os.path.join(p, '../../proto') sys.path.insert(0, p) - pb_version = subprocess.getstatusoutput('protoc --version')[1] + s = sys.version + if s.startswith('2'): + import commands + pb_version = commands.getstatusoutput('protoc --version')[1] + else: + import subprocess + pb_version = subprocess.getstatusoutput('protoc --version')[1] ver_str = pb_version.split(' ')[-1].replace('.', '') ver_int = int(ver_str) - assert vaer_int >= 360, 'The version of protobuf must be larger than 3.6.0!' + assert ver_int >= 360, 'The version of protobuf must be larger than 3.6.0!' import caffe_pb2 return caffe_pb2 -- GitLab