On Tuesday, February 6, 2024 at 11:40:00 AM UTC-8 apinho wrote:

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


I would say that >90% is straightforward.   Clean up all your "print" 
statements to "print()" calls, and that will get most of it.  There are a 
couple of other syntactical changes, but not very many.  Depending on your 
needs, though, there may be some standard library that is no longer 
standard library.  I encountered this around some special cases for needing 
to use urllib2.

Good luck!

/dps


On Tuesday 6 February 2024 at 17:25:31 UTC Massimiliano wrote:

Take a look to pyenv or nix to install a python version apart from the 
system

On Mon, Feb 5, 2024 at 5:37 PM apinho <jaap...@sapo.pt> wrote:

Hello everyone,

I just migrated an old (2017-ish) web2py app, which was still hosted on a 
user machine, running on Rocket HTTP server.

The app is now on a CentOS 7 VM, under nginx/uwsgi using HTTPS.
Web2py version is 2.27.1, over Python 2.7.5, in a virtualenv.

All is OK as for the app itself, but now I as trying to setup cron to to 
delete old sessions, and I'm stuck with this :
*$ python web2py.py -S <myapp> -M -R scripts/sessions2trash.py -A -o -X 
3600 -f -v*
Traceback (most recent call last):
  File "web2py.py", line 44, in <module>
    import gluon.widget
  File "/home/apinho/web2py/web2py/gluon/widget.py", line 28, in <module>
    from gluon.console import console, is_appdir
  File "/home/apinho/web2py/web2py/gluon/console.py", line 53, in <module>
    from gluon.shell import die
  File "/home/apinho/web2py/web2py/gluon/shell.py", line 305
    exec(read_pyc(pycfile), _env)
SyntaxError: unqualified exec is not allowed in function 'run' it contains 
a nested function with free variables

I really have no clue what to do. There is little help online. The only one 
I could find says that upgrading to Python 2.7.18 would do the trick, but 
that would most probably wreck Centos7 (Which I am stuck with, for it is my 
company's mandatory Linux distro for production environments).

Any help would be much appreciated.
Alexandre

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/575fdca2-1b6d-4107-8b99-9c5eeeee5a30n%40googlegroups.com
 
<https://groups.google.com/d/msgid/web2py/575fdca2-1b6d-4107-8b99-9c5eeeee5a30n%40googlegroups.com?utm_medium=email&utm_source=footer>
.



-- 
Massimiliano

-- 
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/27edec30-7eb4-4293-90c1-1ca5758623f7n%40googlegroups.com.

Reply via email to