8000 chore: Raise meaningful errors when importing a2a modules for python 3.9 · tangingw/adk-python@913d771 · GitHub
[go: up one dir, main page]

Skip to content

Commit 913d771

Browse files
seanzhougooglecopybara-github
authored andcommitted
chore: Raise meaningful errors when importing a2a modules for python 3.9
PiperOrigin-RevId: 773128206
1 parent 58e07ca commit 913d771

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/google/adk/a2a/converters/part_converter.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,20 @@
2020

2121
import json
2222
import logging
23+
import sys
2324
from typing import Optional
2425

25-
from a2a import types as a2a_types
26+
try:
27+
from a2a import types as a2a_types
28+
except ImportError as e:
29+
if sys.version_info < (3, 10):
30+
raise ImportError(
31+
'A2A Tool requires Python 3.10 or above. Please upgrade your Python'
32+
' version.'
33+
) from e
34+
else:
35+
raise e
36+
2637
from google.genai import types as genai_types
2738

2839
from ...utils.feature_decorator import working_in_progress

0 commit comments

Comments
 (0)
0