python3 + web2py + Lighttpd + fastcgi

94 views
Skip to first unread message

patito feo

unread,
Mar 21, 2020, 7:11:38 PM3/21/20
to web2py-users
Hi all,

I've been trying to run web2py using python3 but unable to do it sucessful.
Using latest build 2.19.1

I keep getting this error:

 Traceback (most recent call last):
  File "/folder/folder/folder/fcgihandler.py", line 44, in <module>
    import gluon.contrib.gateways.fcgi as fcgi
  File "/folder/folder/folder/gluon/contrib/gateways/fcgi.py", line 439
    s = struct.pack('!L', nameLength | 0x80000000L)
                                                 ^
SyntaxError: invalid syntax

Please help me find a solution or a replacement.


Cheers,

Massimo Di Pierro

unread,
Mar 21, 2020, 9:26:06 PM3/21/20
to web2py-users
Fixed right now on github. Python 3 does not like the L

patito feo

unread,
Mar 21, 2020, 11:12:01 PM3/21/20
to web2py-users
Thank you Massimo.

As a result the code now shows more "L" cases, i just removed them. But now it presents incompatibilities with exceptions and raises.

  File , line 618
    def _end(self, appStatus=0L, protocolStatus=FCGI_REQUEST_COMPLETE):
                              ^
SyntaxError: invalid syntax

  File , line 1080
    except select.error, e:
                       ^
SyntaxError: invalid syntax


  File , line 1134
    raise NotImplementedError, self.__class__.__name__ + '.handler'
                             ^
SyntaxError: invalid syntax


  File , line 1317
    name, cgi.escape(`environ[name]`))
                     ^
SyntaxError: invalid syntax


As i told you before the "L" cases i fixed them, but this others errors dont know how to fixed them.


Thanks for your help.

Massimo Di Pierro

unread,
Mar 22, 2020, 5:07:19 PM3/22/20
to web2py-users
I just fixed these issues and a few more. still skeptical this works with py3 without more changes. Thanks for you help

patito feo

unread,
Mar 22, 2020, 8:23:08 PM3/22/20
to web2py-users
Massimo thank you very much for your effort.

  File , line 57, in <module>
    fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()
  File , line 1178, in __init__
    self._app_lock = thread.allocate_lock()
NameError: global name 'thread' is not defined

I guess this takes more work. I wonder if is it possible to use tornado in a production enviroment, using ssl certs like py4web.
Web2py's anyserver.py doesnt support ssl certs, so it cant be used in production.



Thanks for all your work.

Massimo Di Pierro

unread,
Mar 24, 2020, 12:20:42 AM3/24/20
to web2py-users
I guess we would have to replace calls to thread. to threading.

Why not use nginx which is kind of the standard today?

Dave S

unread,
Mar 26, 2020, 12:58:57 AM3/26/20
to web2py-users


On Saturday, March 21, 2020 at 4:11:38 PM UTC-7, patito feo wrote:
Hi all,


Hi!  I hope you're enjoying using web2py.  But ... Google doesn't make it clear, but checking "show at the top" should be reserved for long-lived threads, rather than for the topic of the day.

BTW, my production server is one of the ones using nginx -- very easy to work with.  And very nice blog.

/dps

patito feo

unread,
Mar 26, 2020, 8:47:21 AM3/26/20
to web2py-users
Thank you Massimo.

I will start deploying testing on debian Buster.
Reply all
Reply to author
Forward
0 new messages