Thanks for your feedback Jim.
Since there are known problems with python-redis3 i force python-redis2
(2.10.6)

I tried your suggestion but it fails

 if 'unique_key' in self and rtn['unique_key'] == self.unique_key:
TypeError: argument of type 'MockQuery' is not iterable

Did anyone succeed in running redis sessions in python3 ??

Thanks

stephane



Le sam. 18 mai 2019 à 13:27, Jim Steil <ato.st...@gmail.com> a écrit :

> Have you tried python3 with web2py and python-redis 2?
>
> My problem was going to python-redis 3 using python2 and web2py.
>
> Would it help to change that line to:
>
> if 'unique_key' in self and rtn['unique_key'] == self.unique_key:
>
>
>
> -Jim
>
>
> On Sat, May 18, 2019 at 3:47 AM rastafarien <stephane.krikor...@gmail.com>
> wrote:
>
>> Hello
>> I tried my best but can't make  web2py 2.18.5 (latest) work with python3
>> and redis (2 or 3)
>> I tried to alter dd definition in globals.py as suggested by jim
>> converting to string False, datetime and unique_key but i always end up
>> with
>>
>> Traceback (most recent call last):
>>   File "/usr/local/web2py/gluon/restricted.py", line 219, in restricted
>>     exec(ccode, environment)
>>   File "/usr/local/web2py/applications/welcome/models/db.py" 
>> <https://bobapp-test.flemzouille.com:8443/admin/default/edit/welcome/models/db.py>,
>>  line 42, in <module>
>>     session.connect(request, response, db = sessiondb)
>>   File "/usr/local/web2py/gluon/globals.py", line 966, in connect
>>     row = table(record_id, unique_key=unique_key)
>>   File "/usr/local/web2py/gluon/contrib/redis_session.py", line 117, in 
>> __call__
>>     row = q.select()
>>   File "/usr/local/web2py/gluon/contrib/redis_session.py", line 189, in 
>> select
>>     if rtn['unique_key'] == self.unique_key:
>> KeyError: 'unique_key'
>>
>> Can anyone help me having web2py python3  and redis (whatever version) work ?
>>
>> I don't want to go back to python2 - spent too much time making the changes 
>> so that may app works with python3 ...
>>
>> Help would be greatly appreciated
>>
>> Stéphane
>>
>> Le mercredi 20 mars 2019 05:07:43 UTC+1, Joe Barnhart a écrit :
>>>
>>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/0iU2wqSik0k/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/367f279c-f329-47b2-830b-bc3c4f62e82a%40googlegroups.com
>> <https://groups.google.com/d/msgid/web2py/367f279c-f329-47b2-830b-bc3c4f62e82a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAERBpoB_kjwwc2Dm293AXHOxULcXkvOgS7vFp08R-7QGszGFcw%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CAERBpoB_kjwwc2Dm293AXHOxULcXkvOgS7vFp08R-7QGszGFcw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGdSxfOHoDn3W9NfeimZ_nL14prLG%2B_5kdSqBt7yS0QmdQQpgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to