我在运行时遇到了微软用于人脸识别的视觉认知 api 的问题python create_person.py user52
Traceback (most recent call last):
File "create_person.py", line 9, in <module>
res = CF.person.create(personGroupId, str(sys.argv[1]))
File ".../cognitive_face/person.py", line 74, in create
return util.request('POST', url, json=json)
File ".../cognitive_face/util.py", line 106, in request
response.status_code, response.text)
cognitive_face.util.CognitiveFaceException: Error when calling Cognitive Face API:
status_code: 404
code: 404
message: { "statusCode": 404, "message": "Resource not found" }
这是我的 create_person.py 文件
import sys
import cognitive_face as CF
from global_variables import personGroupId
import sqlite3
Key = 'b065632b79ac4d97a96d5781463d54b1'
CF.Key.set(Key)
if len(sys.argv) is not 1:
res = CF.person.create(personGroupId, str(sys.argv[1]))
print(res)
extractId = str(sys.argv[1])[-2:]
connect = sqlite3.connect("Face-DataBase")
cmd = "SELECT * FROM Students WHERE ID = " + extractId
cursor = connect.execute(cmd)
isRecordExist = 0
for row in cursor: # checking wheather the id exist or not
isRecordExist = 1
if isRecordExist == 1: # updating name and roll no
connect.execute("UPDATE Students SET personID = ? WHERE ID = ?",(res['personId'], extractId))
connect.commit() # commiting into the database
connect.close()
print ("Person ID successfully added to the database")
感谢您的帮助。