On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari wrote:
>
> Thank you Ben,
>
> I was looking at  the same official page ;-)
> It seems that  using the io module is the way to go, and it's already used 
> in pymysql . I'm testing it.
>
> Nobody has suggestions about the session.foget() and session.flash message?
>
> thank you,
> nico
>
>
Where is the session.forget() call?  Is it part of the error path?  Or did 
you set up your index() function to do that>

/dps
 

> Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan <linu...@gmail.com 
> <javascript:>> ha scritto:
>
>> Also found this:
>>
>> http://python-future.org/compatible_idioms.html
>>
>> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan <linu...@gmail.com 
>> <javascript:>> wrote:
>>
>>> Try These suggestions:
>>>
>>>
>>> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/844443
>>> http://www.evanjones.ca/python-utf8.html
>>>
>>>
>>> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari <nico...@gmail.com 
>>> <javascript:>> wrote:
>>>
>>>> Hi,
>>>>
>>>> the encode-decode problem on question 1 is mostly related to the 
>>>> opening of files. For example:
>>>>
>>>>     filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>>>>     if PY2:
>>>>         lines = open(filename)
>>>>     else:
>>>>         lines = open(filename, encoding='utf-8')
>>>>
>>>> In PY2 there is no option for the encoder, while on PY3 it is 
>>>> mandatory. 
>>>>
>>>> I'm still learning, too ;-)
>>>> Nico
>>>>
>>>>
>>>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan <linu...@gmail.com 
>>>> <javascript:>> ha scritto:
>>>>
>>>>> Exactly what are you running into?
>>>>>
>>>>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>>>>> ......
>>>>>     f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>>>>> had to become
>>>>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>>>>
>>>>> And so one. 
>>>>>
>>>>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>>>>
>>>>> FWIW, I'm just making the transition to Python 3,6 so I'm learning 
>>>>> things the hard way ...
>>>>>
>>>>> Ben Duncan
>>>>>      
>>>>>
>>>>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari <nico...@gmail.com 
>>>>> <javascript:>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm playing with the web2py-book app, in order to make it python 3 
>>>>>> compatible and also to improve it a bit. I have a couple of questions 
>>>>>> related to default.py:
>>>>>>
>>>>>> 1. there were some encode-decode errors. I was able to resolve them 
>>>>>> (see https://github.com/nicozanf/web2py-book for a preview) but I 
>>>>>> was forced to use many "IF PY2 / else" conditions, in order to preserve 
>>>>>> python 2.7 compatibility.  Is there a more elegant and pythonic solution 
>>>>>> to 
>>>>>> manage this and similar situations?
>>>>>>
>>>>>> 2. I've added a try/except condition, in order to catch a missing 
>>>>>> library (pygments). It works fine, but the session.flash error message 
>>>>>> is 
>>>>>> not displayed at all because it's followed by a  redirect to index 
>>>>>> itself 
>>>>>> and there is a session.forget() on the top that cleans it. If I comment 
>>>>>> the 
>>>>>> session.forget() the flash message is correctly displayed. What can I do?
>>>>>>
>>>>>> Cheers,
>>>>>> Nico
>>>>>>
>>>>>> -- 
>>>>>> 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+un...@googlegroups.com <javascript:>.
>>>>>> 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+un...@googlegroups.com <javascript:>.
>>>>> 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+un...@googlegroups.com <javascript:>.
>>>> 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+un...@googlegroups.com <javascript:>.
>> 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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to