diff --git a/person.py b/person.py index 993322e..deb2e43 100644 --- a/person.py +++ b/person.py @@ -105,8 +105,15 @@ def AddRefimgToPerson( filename, person ): settings = Settings.query.first() model=AIModel.query.get(settings.default_refimg_model) refimg.face, face_locn = GenFace( filename, model=model.name ) - os.remove(filename) + try: + os.remove(filename) + except Exception as e: + # can fail "silently" here, if the face_locn worked, great, its only + # a tmp file in /tmp - if not, the next if will send a msg to the front-end + print( f"Failed to delete tmp file for refimg addition: {e}" ) + if not face_locn: + st.SetMessage( f"Failed to find face in Refimg:" ) raise Exception("Could not find face in uploaded reference image" ) return refimg.face_locn = json.dumps(face_locn) @@ -383,7 +390,6 @@ def remove_force_match_override(): FaceForceMatchOverride.query.filter( FaceForceMatchOverride.face_id==face_id ).delete() db.session.commit() - print( f"person_tag={person_tag}" ) # needed to use person_id in job below (allows consistent processing in job_mgr) p=Person.query.filter(Person.tag==person_tag).one()