Unable to start web2py 2.15.2 with ssl

249 views
Skip to first unread message

José Leite

unread,
Aug 3, 2017, 5:57:45 PM8/3/17
to web2py-users
With the following command line in windows I get:

C:\web2py\web2py.py -a admin -i 192.168.8.100 -p 443 -c server.crt -k server.key -Y

----------------------------------------------------------------------------------------------------------

web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2017
Version 2.15.2-stable+timestamp.2017.07.19.12.18.41
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

please visit:
use "taskkill /f /pid 7316" to shutdown the web2py server


Traceback (most recent call last):
  File "C:\web2py\web2py.py", line 33, in <module>
    gluon.widget.start(cron=True)
  File "C:\web2py\gluon\widget.py", line 1319, in start
    interfaces=options.interfaces)
  File "C:\web2py\gluon\main.py", line 748, in __init__
    elif not rocket.ssl:
AttributeError: 'module' object has no attribute 'ssl'





Leonel Câmara

unread,
Aug 3, 2017, 8:37:07 PM8/3/17
to web2py-users
That's actually a bug. It should be

elif not rocket.has_ssl:

You can fix it directly in your gluon/main.py to solve your problem until a version with the fix is released.

José Leite

unread,
Aug 4, 2017, 11:37:19 AM8/4/17
to web2py-users
Ok Leonel,

correction done but the rocket server can not provide a secure connection anyway. Is it a missing feature in the new version or am I doing something wrong?

Este site não consegue fornecer uma ligação segura

127.0.0.1 enviou uma resposta inválida.

ERR_SSL_PROTOCOL_ERROR

Leonel Câmara

unread,
Aug 4, 2017, 11:44:20 AM8/4/17
to web2py-users
You are running a python version that was not compiled with ssl support. Since this is a development environment you could simply not demand https if the request is_local.  

José Leite

unread,
Aug 4, 2017, 11:54:52 AM8/4/17
to web2py-users
Well Leonel,

before I upgraded to web2py 2.15.2 Python was working fine with ssl even locally.
I have python 2.7.11 exactly because I needed the newest ssl protocols to work with PayPal.
Strange...!?!?!?!!?

José Leite

unread,
Aug 4, 2017, 11:55:54 AM8/4/17
to web2py-users
But you are right maybe I don't need it locally.

Leonel Câmara

unread,
Aug 4, 2017, 11:58:14 AM8/4/17
to web2py-users
Still, probably a bug if it still doesn't work with the has_ssl change, submit an issue.

José Leite

unread,
Aug 4, 2017, 12:18:45 PM8/4/17
to web2py-users
Thanks, just submitted the issue.

Dave S

unread,
Aug 4, 2017, 5:20:24 PM8/4/17
to web2py-users


On Friday, August 4, 2017 at 8:54:52 AM UTC-7, José Leite wrote:
Well Leonel,

before I upgraded to web2py 2.15.2 Python was working fine with ssl even locally.
I have python 2.7.11 exactly because I needed the newest ssl protocols to work with PayPal.
Strange...!?!?!?!!?

If there was any version information shown with that , you didn't paste it here.  My weak translation of the error message suggests you're running on a Windows machine; are you running the exe file or from source?  (The exe uses it's own Python.  I would have expected it to have SSL support, but I don't test that currently, so can't vouch for it  Windows is my home web2py development environment.)

/dps


José Leite

unread,
Aug 4, 2017, 5:47:07 PM8/4/17
to web2py-users
Yes I am running on a windows machine and run web2py from the .exe file not from source.

The command line is:

C:\web2py\web2py.py -a admin -i 192.168.8.100 -p 443 -c server.crt -k server.key -Y

but it doesn't start the https version of the site and all https://* calls to externeal services are not working either.

No SSL from the moment I upgraded to web2py 2.15.2.

José Leite

unread,
Aug 4, 2017, 5:48:19 PM8/4/17
to web2py-users
Sorry I meant from source not .exe

Dave S

unread,
Aug 4, 2017, 5:57:53 PM8/4/17
to web2py-users


On Friday, August 4, 2017 at 2:48:19 PM UTC-7, José Leite wrote:
Sorry I meant from source not .exe


When you start web2py, it will print not only its own version but the version of python it is using.  Can you confirm that information here?

/dps

José Leite

unread,
Aug 4, 2017, 6:27:03 PM8/4/17
to web2py-users
It doesn't print that information but the admin console says its Python 2.7.11 and after my upgrade 2.7.13

José Leite

unread,
Aug 4, 2017, 6:35:11 PM8/4/17
to web2py-users
Python 2.7.11 worked fine before the web2py upgrade. But I even tried to update the version to the new 2.7.13 (all 32bit - the machine is 64).

José Leite

unread,
Aug 4, 2017, 6:57:29 PM8/4/17
to web2py-users
Admin console information:

2.15.2-stable+timestamp.2017.07.19.12.18.41
(A correr em Rocket 1.2.6, Python 2.7.13)

Dave S

unread,
Aug 4, 2017, 8:15:21 PM8/4/17
to web2py-users


On Friday, August 4, 2017 at 3:57:29 PM UTC-7, José Leite wrote:
Admin console information:

2.15.2-stable+timestamp.2017.07.19.12.18.41
(A correr em Rocket 1.2.6, Python 2.7.13)

Just to be way too into verification, can you open a regular python shell, and do "import ssl" and "ssl.RAND_status()" ?

In the meantime, someone who actually knows something may be along

/dps

José Leite

unread,
Aug 5, 2017, 8:06:07 AM8/5/17
to web2py-users
I did as you asked and in a shell did
import ssl
ssl.RAND_status() is 1L

José Leite

unread,
Aug 5, 2017, 8:07:23 AM8/5/17
to web2py-users
Actual Rocket code:
------------------------------------------------------------

# Import System Modules
import sys
import time
import socket
try:
    import ssl
    has_ssl = True
except ImportError:
    has_ssl = False
# Import Package Modules
# package imports removed in monolithic build
# TODO - This part is still very experimental.
# from .filelike import FileLikeSocket

José Leite

unread,
Aug 5, 2017, 8:59:54 AM8/5/17
to web2py-users
If I import ssl directly in the main.py module I get the following error:

Traceback (most recent call last):
  File "C:\web2py\web2py.py", line 21, in <module>
    import gluon.widget
  File "C:\web2py\gluon\widget.py", line 26, in <module>
    from gluon import main, newcron
  File "C:\web2py\gluon\main.py", line 28, in <module>
    import ssl
  File "C:\Python27\lib\ssl.py", line 126, in <module>
    from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN
ImportError: cannot import name HAS_ALPN

Massimo Di Pierro

unread,
Aug 7, 2017, 10:15:33 AM8/7/17
to web2py-users
Included the fix in 2.15.3 but please check it in case I got it wrong.
Reply all
Reply to author
Forward
0 new messages