diff --git a/hb_server/apps/hrm/services.py b/hb_server/apps/hrm/services.py index 8cfb277..7f7334b 100644 --- a/hb_server/apps/hrm/services.py +++ b/hb_server/apps/hrm/services.py @@ -28,8 +28,11 @@ class HRMService: face_users = cache.get('face_users') if face_datas is None: update_all_user_facedata_cache() - - results = face_recognition.compare_faces(face_datas, unknown_face_encoding, tolerance=0.5) + try: + results = face_recognition.compare_faces(face_datas, + unknown_face_encoding, tolerance=0.5) + except: + return None, '识别失败' for index, value in enumerate(results): if value: # 识别成功