"import ssl" impossible in Web2py with python 2.7.9 but "import ssl" working with python 2.7.9

118 views
Skip to first unread message

e27...@gmail.com

unread,
Jun 6, 2017, 6:32:22 AM6/6/17
to web2py-users

I have sending email problems that I am sure are related to SSL/TLS.

I am running the last Web2py version with Python 2.7.9 and Apache 2.4

When I make a mail script with SMTPLIB, Web2py tells me that SSL is not present. When I want to "import ssl" within a Web2py script, no ssl module is found.

But when I import ssl in a python script outside Webpy, import ssl is working !

Any Idea ?

Thierry

Dave S

unread,
Jun 6, 2017, 3:21:47 PM6/6/17
to web2py-users

Your SSL module is probably in your Python's site packages, and web2py may not be looking there
(it has its own ideas about where packages should be).  Or perhaps you have multiple Python installations.

Is this a linux system?

/dps


 
Any Idea ?

Thierry

Anthony

unread,
Jun 6, 2017, 3:43:19 PM6/6/17
to web2py-users

Your SSL module is probably in your Python's site packages, and web2py may not be looking there
(it has its own ideas about where packages should be).

No, web2py will find modules in the usual Python search path, though it will also find modules in the /modules folder of the current application.

Anthony

e27...@gmail.com

unread,
Jun 6, 2017, 4:03:09 PM6/6/17
to web2py-users
Funny thing :

On the distant server,

1/ If I launch the mail controller from Web2py.exe (127.0.0.1/admin), it does find SSL module (python version 2.7.9) --> the mail is sent

2/ If I launch the mail controller as 'localhost/admin' i.e. through Apache 2.4, it does not find the SSL module (python 2.7.10, the one that is installed) --> the mail is not sent

What is going on there ?

It looks like Apache does something with the Python SSL module.

Very strange.

Any idea ?

Anthony

unread,
Jun 7, 2017, 11:17:46 AM6/7/17
to web2py-users
On Tuesday, June 6, 2017 at 4:03:09 PM UTC-4, e27...@gmail.com wrote:
Funny thing :

On the distant server,

1/ If I launch the mail controller from Web2py.exe (127.0.0.1/admin), it does find SSL module (python version 2.7.9) --> the mail is sent

2/ If I launch the mail controller as 'localhost/admin' i.e. through Apache 2.4, it does not find the SSL module (python 2.7.10, the one that is installed) --> the mail is not sent

What is going on there ?

The Windows binary version of web2py (i.e., web2py.exe) includes its own Python interpreter and standard library, so when you run it, you are not using the Python installed on your system. Apparently the Python 2.7.10 you have installed on your system does not include the SSL module.

Note, in general, if you have Python installed on your system, there is no particular reason to run the binary version of web2py -- just run from source.

Also, for future reference, when having a problem (particularly something that seems related to the Python installation), it is a good idea to report your OS and the version of web2py (i.e., source vs. binary).

Anthony
Reply all
Reply to author
Forward
0 new messages