Suppress YouTube Test ConnectionError (#13357)

This commit is contained in:
Glenn Jocher 2024-06-04 14:06:29 +02:00 committed by GitHub
parent cf081c4db7
commit 993ba7a20b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,7 +140,8 @@ def test_youtube():
model = YOLO(MODEL)
try:
model.predict("https://youtu.be/G17sBkb38XQ", imgsz=96, save=True)
except urllib.error.HTTPError as e: # handle 'urllib.error.HTTPError: HTTP Error 429: Too Many Requests'
# Handle internet connection errors and 'urllib.error.HTTPError: HTTP Error 429: Too Many Requests'
except (urllib.error.HTTPError, ConnectionError) as e:
LOGGER.warning(f"WARNING: YouTube Test Error: {e}")