Hello Joe,
based on this 
https://github.com/andymccurdy/redis-py/issues/1071#issuecomment-439199774
looks like Redis had a backward incompatible changes and keys in 
dictionaries cannot be bool (values can).
I reviewed the web2py code and I can confirm no change on our side.

Random thoughts: It was a design mistake on my side to allow pickle to 
store sessions. I should have used json. This would have restricted what 
can go in a session but would have made the serialized session more 
portable and the whole logic faster. In that case only str keys would have 
been allowed. Web3py will use json for sessions or move away from sessions 
completely.

Massimo

On Tuesday, 19 March 2019 21:07:43 UTC-7, Joe Barnhart wrote:
>
> Has something changed in the operation of redis to store sessions in 
> web2py when we use python3 instead of python2?  I'm hitting an error in the 
> py-redis library that complains I can't store a boolean in redis 
> (unsupported data type).  Since this seems to be a well known design 
> feature of redis I'm wondering how it seemed to work before.  It's been 
> awhile since I used it, but I swear it worked before.  Didn't it?  Maybe I 
> dreamed it.
>
> -- Joe
>
> Message:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
>
> Traceback (most recent call last):
>   File "/Users/jbarnhart/Work/w2p/w2p_ss_new/gluon/main.py", line 444, in 
> wsgibase
>     serve_controller(request, response, session)
>   File "/Users/jbarnhart/Work/w2p/w2p_ss_new/gluon/main.py", line 206, in 
> serve_controller
>     raise HTTP(response.status, page, **response.headers)
> gluon.http.HTTP: 200 OK
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/Users/jbarnhart/Work/w2p/w2p_ss_new/gluon/main.py", line 460, in 
> wsgibase
>     session._try_store_in_db(request, response)
>   File "/Users/jbarnhart/Work/w2p/w2p_ss_new/gluon/globals.py", line 1239, in 
> _try_store_in_db
>     record_id = table.insert(**dd)
>   File "/Users/jbarnhart/Work/w2p/w2p_ss_new/gluon/contrib/redis_session.py", 
> line 150, in insert
>     pipe.execute()
>   File 
> "/Users/jbarnhart/.virtualenv/py3/lib/python3.7/site-packages/redis/client.py",
>  line 3520, in execute
>     return execute(conn, stack, raise_on_error)
>   File 
> "/Users/jbarnhart/.virtualenv/py3/lib/python3.7/site-packages/redis/client.py",
>  line 3385, in _execute_transaction
>     all_cmds = connection.pack_commands([args for args, options in cmds
>   File 
> "/Users/jbarnhart/.virtualenv/py3/lib/python3.7/site-packages/redis/connection.py",
>  line 687, in pack_commands
>     for chunk in self.pack_command(*cmd):
>   File 
> "/Users/jbarnhart/.virtualenv/py3/lib/python3.7/site-packages/redis/connection.py",
>  line 663, in pack_command
>     for arg in imap(self.encoder.encode, args):
>   File 
> "/Users/jbarnhart/.virtualenv/py3/lib/python3.7/site-packages/redis/connection.py",
>  line 114, in encode
>     raise DataError("Invalid input of type: 'bool'. Convert to a "
> redis.exceptions.DataError: Invalid input of type: 'bool'. Convert to a byte, 
> string or number first.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to