You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run a flask code, it worked well at the beginning, but one day later it always raised an error. The error message is as follows:
[2022-09-08 10:50:36,904] ERROR in app: Exception on /sim [POST]
Traceback (most recent call last):
File "/root/miniconda3/envs/simple/lib/python3.7/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/root/miniconda3/envs/simple/lib/python3.7/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/miniconda3/envs/simple/lib/python3.7/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/root/miniconda3/envs/simple/lib/python3.7/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "flask_main.py", line 62, in sim
result = json.dumps(res1,default=json_encoder)#,cls=NpEncoder
File "/root/miniconda3/envs/simple/lib/python3.7/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/root/miniconda3/envs/simple/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/root/miniconda3/envs/simple/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
ValueError: Circular reference detected
The code is as follows:
@app.route('/sim',methods=['POST'])
def sim():
try:
res = MOC.make_order(**request.form)
# print(res)
res1 = {"response":200,'result':res}
except Exception as e:
res1 = {"response":404, 'result': [e]}
print(61,res1)
result = json.dumps(res1,default=json_encoder)#,cls=NpEncoder
return result
Every time I restart the program, it works well again. I really don't know where the problem is. Can you help me? Thank you!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When I run a flask code, it worked well at the beginning, but one day later it always raised an error. The error message is as follows:
The code is as follows:
Every time I restart the program, it works well again. I really don't know where the problem is. Can you help me? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions