Ok, thank you, a lot. I'll do as you recommend. Alexandre On Wednesday 7 February 2024 at 18:30:16 UTC donal...@gmail.com wrote:
> Moving web2py from py2 to py3 should be very straightforward. What may or > may not be straightforward is moving your web2py applications from py2 to > py3 as that depends a fair bit on how they have been written and certainly > encoding and changes to string handling between py2 and py3 could need some > work. However py2 is well beyond it’s sell by date so it would seem > appropriate to move to a relatively recent py3 version if possible. > > Regards > Donald > > Sent from my iPad > > On 6 Feb 2024, at 20:44, web...@googlegroups.com wrote: > > > web...@googlegroups.com > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/web2py/topics> > Google > Groups > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > > Topic digest > View all topics > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/web2py/topics> > > > - Encode problem after migration web2py to CentOs7 > <#m_-2965220727922293261_group_thread_0> - 1 Update > - shell.py, unqualified exec is not allowed > <#m_-2965220727922293261_group_thread_1> - 2 Updates > > Encode problem after migration web2py to CentOs7 > <http://groups.google.com/group/web2py/t/4784fddaca393c79?utm_source=digest&utm_medium=email> > > apinho <jaap...@sapo.pt>: Feb 06 12:09PM -0800 > > Hi, > > I was using an web2py app on : > Windows Server 2016 > 2.18.2-stable+timestamp.2019.02.26.06.11.06 > (Running on Rocket 1.2.6, Python 2.7.9) > > Now, I'm using : > Centos 7 > 2.27.1-stable+timestamp.2023.11.15.23.33.20 > (Running on Unknown, Python 2.7.5) > > I'm having lots of encode problems. > > Take this sample code : > # -*- coding: utf-8 -*- > from __future__ import unicode_literals > def myFunction(): > my_unicode = 'Eusébio' > my_goals = db.executesql("SELECT * FROM goals WHERE scorer = > '{}';".format(my_unicode), as_dict = True) > return dict(my_goals) > > Calling /myapp/test/myFunction works fine on my Windows machine, but fails > on Centos 7 : > Traceback (most recent call last): > File "<obfuscated>/web2py/gluon/restricted.py", line 219, in restricted > exec(ccode, environment) > File " <obfuscated> /web2py/applications/ <obfuscated> > /controllers/test.py", > line 7, in <module> > File " <obfuscated> /web2py/gluon/globals.py", line 463, in <lambda> > self._caller = lambda f: f() > File " <obfuscated> /web2py/applications/ <obfuscated> > /controllers/test.py", > line 5, in myFunction > my_goals = db.executesql("SELECT * FROM goals WHERE scorer = > '{}';".format(my_unicode), as_dict = True) > File " <obfuscated> /web2py/gluon/packages/dal/pydal/base.py", line 882, > in executesql > adapter.execute(query) > File " <obfuscated> > /web2py/gluon/packages/dal/pydal/adapters/__init__.py", > line 70, in wrap > return f(*args, **kwargs) > File " <obfuscated> /web2py/gluon/packages/dal/pydal/adapters/mssql.py", > line 128, in execute > args[0] = to_unicode(args[0]) > File " <obfuscated> /web2py/gluon/packages/dal/pydal/_compat.py", line > 173, in to_unicode > return obj.decode(charset, errors) > File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 39: ordinal not in range(128) > > I'm now considering installing Python3 (Check my other post : Shell.py, > unqualified exec is not allowed), or would it be safer to stay with > Python2.7.5 and just install an older version of web2py ? > > Can you help explain this error to me ? > > Alexandre > Back to top <#m_-2965220727922293261_digest_top> > shell.py, unqualified exec is not allowed > <http://groups.google.com/group/web2py/t/cd8384957e143fae?utm_source=digest&utm_medium=email> > > Massimiliano <mbel...@gmail.com>: Feb 06 06:25PM +0100 > > Take a look to pyenv or nix to install a python version apart from the > system > > > -- > Massimiliano > apinho <jaap...@sapo.pt>: Feb 06 11:40AM -0800 > > Hi, > > Thank you. > > I was under the impression that web2py was only compatible with Python2.7, > and that py4web was for Python3x. > I now understand that py2web has been modified and is also compatible with > Python3, up to 3.11. > > That definitely opens new horizons for me. I might try to install Python3 > alongside, and use it's venv. > I think that might be less confusing than trying to install a newer > Python2.7 version, on this system, do you agree ? > > Is migrating an web2py from Python2.7 to Python 3x a straightforward task > ? > Or might it need some code refactoring ? > > Alexandre > > On Tuesday 6 February 2024 at 17:25:31 UTC Massimiliano wrote: > > Back to top <#m_-2965220727922293261_digest_top> > You received this digest because you're subscribed to updates for this > group. You can change your settings on the group membership page > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/web2py/join> > . > To unsubscribe from this group and stop receiving emails from it send an > email to web2py+un...@googlegroups.com. > > -- 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/187ffe03-8d93-447f-a67d-5d1e81c75c8dn%40googlegroups.com.