Closed dn4hc closed 5 years ago
This doesn't give much information. What platform are you trying to run the script on? When is this error occurring? Have you followed the instructions in the readme?
Raspbian on Raspberry Pi 2, I can start the script successfully however this error occurs when logging in.
this fixed it in /7Eleven-Python/functions.py
returnContent = json.loads(response.content) **to**
returnContent = json.loads(str(response.content, "utf-8"))
Getting the same error again when locking in
[2019-08-13 05:28:16,378] ERROR in app: Exception on /lockin [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "app.py", line 359, in lockin
returnContent = json.loads(returnContent)
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
Does it happen when you login too? Or when you logout?
Login works fine. Only when locking.
Are you using the latest version of app.py? Your error says that line 359 is returnContent = json.loads(returnContent)
, whereas the current version line 359 is # If there is a fuel lock already in place we get an error!
.
What does the very first line of your app.py say? It should begin with #-*- coding: utf8 -*-
Im getting same error, only when locking in using new version of app.py
[2019-08-22 13:22:25,979] ERROR in app: Exception on /lockin [POST] Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "app.py", line 357, in lockin returnContent = json.loads(returnContent) File "/usr/lib/python3.5/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes'
Should we close this issue? :S