Currently working on CS50W's Project1, working with the GoodReads API. I thought the Register/Login/Logout requirements would be easy and quick for me to complete since I did it already with the CS50 Finance project. However, I am running into this issue:
TypeError: cannot pickle '_thread._local' object
This is what my Register code looks like:
@app.route("/register", methods=["GET", "POST"])
def register():
"""Register user"""
if request.method == "POST":
username1 = request.form.get("username")
if not username1: # if they leave the space blank, return an apology
return apology("Must provide a username", 403)
# check to ensure the username is unique and doesn't already exist in the table
checkuser = db.execute("SELECT * FROM users WHERE username = :username", {"username": username1}).fetchone()
# etc etc etc
# insert the new user into the table
new_user_id = db.execute("INSERT INTO users (username, hash) VALUES (:username, :hash)", {"username": username1, "hash": hashedpass})
db.commit()
db.close()
# etc etc
My database is updating with new users that I register, but the website shows this error and I can't continue. Any pointers to why this may be happening?
return self.wsgi_app(environ, start_response)
,response = self.handle_exception(e)
,reraise(exc_type, exc_value, tb)
,raise value
,response = self.full_dispatch_request()
,return self.finalize_request(rv)
,response = self.process_response(response)
,self.session_interface.save_session(self, ctx.session, response)
,self.cache.set(self.key_prefix + session.sid, data,
, andpickle.dump(value, f, pickle.HIGHEST_PROTOCOL)
. What I don't understand is none of the code I wrote is mentioned