Getting error when sending large file to flask - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #4690
Answered
by
ThiefMaster
martinenkoEduard
asked this question in
Q&A
-
i am getting error json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) @app.route("/detectAndSaveAllFaces", methods=["POST"])
def upload_file():
if request.method == "POST":
if "file1" not in request.files:
return "there is no file1 in form!"
file1 = request.files["file1"]
data = request.files['file1'].read()
filemd5 = hashlib.md5(file1.read()).hexdigest()
filesha1 = hashlib.sha1(file1.read()).hexdigest()
response = detection.detect(data)
print(response) Traceback (most recent call last):
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 2095, in __call__
return self.wsgi_app(environ, start_response)
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 2080, in wsgi_app
response = self.handle_exception(e)
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/home/administrator/anaconda3/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/administrator/code/flask/SQLAlchemy_example.py", line 90, in upload_file
response = detection.detect(data)
File "/home/administrator/anaconda3/lib/python3.9/site-packages/compreface/service/detection_service.py", line 55, in detect
return self.detect_face_from_image.execute(request, pass_dict(
File "/home/administrator/anaconda3/lib/python3.9/site-packages/compreface/use_cases/detect_face_from_image.py", line 37, in execute
result: dict = self.detect_face_from_image.post(
File "/home/administrator/anaconda3/lib/python3.9/site-packages/compreface/client/detect_face_from_image.py", line 63, in post
return result.json()
File "/home/administrator/anaconda3/lib/python3.9/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/home/administrator/anaconda3/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/home/administrator/anaconda3/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/administrator/anaconda3/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) |
Beta Was this translation helpful? Give feedback.
Answered by
ThiefMaster
Jul 12, 2022
Replies: 2 comments
-
I am sending a file using
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Look at the traceback. Your error comes from inside PS: Your flask view function needs to return something or it'll fail - but that's unrelated to your error. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
martinenkoEduard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Look at the traceback. Your error comes from inside
compreface
when it seems to make a network request to something.PS: Your flask view function needs to return something or it'll fail - but that's unrelated to your error.