I'm implementing a Flask web application (that it's running locally on Python 3.1) on Google's App Engine (Python 3.7) and getting the following error:
Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
That's the error log:
{
"textPayload": "Traceback (most recent call last):\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py\", line 2447, in wsgi_app\n response = self.full_dispatch_request()\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py\", line 1953, in full_dispatch_request\n return self.finalize_request(rv)\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py\", line 1970, in finalize_request\n response = self.process_response(response)\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py\", line 2269, in process_response\n self.session_interface.save_session(self, ctx.session, response)\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/flask_session/sessions.py\", line 354, in save_session\n total_seconds(app.permanent_session_lifetime))\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/file.py\", line 224, in set\n self._prune()\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/file.py\", line 159, in _prune\n if self._over_threshold():\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/file.py\", line 102, in _over_threshold\n return self._threshold != 0 and self._file_count > self._threshold\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/file.py\", line 69, in _file_count\n return self.get(self._fs_count_file) or 0\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/file.py\", line 193, in get\n pickle_time = self.serializer.load(f)\n File \"/layers/google.python.pip/pip/lib/python3.7/site-packages/cachelib/serializers.py\", line 29, in load\n data = pickle.load(f)\nValueError: unsupported pickle protocol: 5",
"insertId": "62069f77000ddb77156b638a",
"resource": {
"type": "gae_app",
"labels": {
"version_id": "{VERSION_ID}",
"module_id": "default",
"project_id": "{PROJECT_ID",
"zone": "{ZONE}
}
},
"timestamp": "{DATE}",
"severity": "ERROR",
"labels": {
"clone_id": "00c61b117ccbf120db0bbf309ad2da98e7fc043e3476b10e04eb7dec8eacd8a8fff7a965420d11f752ea4b643abc9f95f12446cbbacbd7d3c1bdefcc1a1f8e9445f4a6d8b98de1d3fe4073120f2464989ace693a"
},
"logName": "projects/{PROJECT_NAME}/logs/stderr",
"receiveTimestamp": "{DATE}"
}
CodePudding user response:
it says ValueError: unsupported pickle protocol: 5
, so probably you need to install python pickle5?
Install pickle5 on your system:
pip install pickle5
import pickle5 instead of pickle in your code:
import pickle5 as pickle
CodePudding user response:
It's complaining about protocol 5 in pickle. Protocol 5 is available from Python 3.8.
From the documentation
Protocol version 5 was added in Python 3.8. It adds support for out-of-band data and speedup for in-band data. Refer to PEP 574 for information about improvements brought by protocol 5.
You can either upgrade to Python 3.8 or use Pickle5 on a lower python version (i.e. your current Python 3.1 and Python 3.7)