File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 29
29
"""This module contains the implementation of a helper class for MySQL X
30
30
Protobuf messages."""
31
31
32
+ try :
33
+ ModuleNotFoundError
34
+ except NameError :
35
+ ModuleNotFoundError = ImportError
36
+
32
37
_SERVER_MESSAGES_TUPLES = (
33
38
("Mysqlx.ServerMessages.Type.OK" ,
34
39
"Mysqlx.Ok" ),
@@ -241,10 +246,10 @@ def parse_server_message(msg_type, payload):
241
246
msg = _mysqlxpb_pure .new_message (msg_type_name )
242
247
msg .ParseFromString (payload )
243
248
return msg
244
- except (ImportError , SyntaxError , TypeError ) as err :
249
+ except (ImportError , ModuleNotFoundError , SyntaxError , TypeError ) as err :
245
250
HAVE_PROTOBUF = False
246
251
HAVE_PROTOBUF_ERROR = err if PROTOBUF_VERSION is not None \
247
- else "Protobuf >=3.0.0 is required"
252
+ else "Protobuf >=3.0.0 is required"
248
253
if not HAVE_MYSQLXPB_CEXT :
249
254
raise ImportError ("Protobuf is not available: {}"
250
255
"" .format (HAVE_PROTOBUF_ERROR ))
You can’t perform that action at this time.
0 commit comments