Re: cherrypy + ssl + pyinstaller

harsh savla <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hi Joseph,

Thanks for your reply. You are right, it was not a cherrypy issue.

Jason Coombds, one of the lead members of the project pointed me to the 
solution. Here is the link: https://github.com/cherrypy/cherrypy/issues/1448

tl;dr

pyinstaller did not recognize the module 'cherrypy.wsgiserver.ssl_builtin' since 
it was being loaded programatically. I had to pass --hidden-import=
cherrypy.wsgiserver.ssl_builtin and it worked after that.



On Thursday, June 23, 2016 at 12:37:23 PM UTC-7, Joseph Tate wrote:
>
> Start removing stuff until it works: chroot, chroot's custom python, 
> pyinstaller, etc. This is not likely a problem with cherrypy. I've never 
> used pyinstaller, but have used py2exe, and haven't had import errors 
> within cherrypy. That said, I had ssl turned off at the time.
>
> ssl_builtin is in cherrypy.wsgiserver, so I'd double check that 1) your 
> pythonpath is set correctly for the chroot, 2) that you're importing the 
> correct cherrypy (and not an old system package version) and 3) that you're 
> using the python executable you're intending to. It sounds like you're 
> importing the wrong cherrypy, or using the wrong python executable.
>
> Joseph
>
> On Thu, Jun 23, 2016 at 3:10 AM harsh savla <[email protected] 
> <javascript:>> wrote:
>
>> I am trying to get cherrypy to work with ssl support.
>>
>> Env:
>>
>> build: debian wheezy 64-bit chroot
>> run:   debian wheezy 64-bit chroot
>> cherrypy: 4.0.0
>> python: 2.7.10 (has ssl support, can import ssl)
>> pyinstaller: 2.1
>>
>>
>> Here is the code:
>>
>> sss.py
>>
>>
>> import cherrypy
>>
>>
>> config = {
>> 'global' : {
>> 'server.socket_host' : '0.0.0.0',
>> 'server.socket_port' : 8888,
>> 'server.thread_pool' : 8,
>> 'server.ssl_module' : 'builtin',
>> 'server.ssl_certificate' : '/certs/cert.pem',
>> #'server.ssl_certificate_chain' : '/path/to/certs/ssl123_ca_bundle.pem',
>> 'server.ssl_private_key' : '/certs/key.pem'
>> }
>> }
>>
>> class App:
>>
>>     @cherrypy.expose
>>     def index(self):
>>         return '*Is this secure?*'
>>
>>
>> if name == 'main':
>>     cherrypy.quickstart(App(), '/', config)
>>
>>
>> I compile the above code with: pyinstaller sss.py and run the resultant 
>> binary on a 64-bit chroot environment (which is same as build env)
>>
>> I see the following traceback.
>>
>> [22/Jun/2016:17:11:29] ENGINE Listening for SIGHUP.
>> [22/Jun/2016:17:11:29] ENGINE Listening for SIGTERM.
>> [22/Jun/2016:17:11:29] ENGINE Listening for SIGUSR1.
>> [22/Jun/2016:17:11:29] ENGINE Bus STARTING
>> [22/Jun/2016:17:11:29] ENGINE Started monitor thread 'Autoreloader'.
>> [22/Jun/2016:17:11:29] ENGINE Started monitor thread '
>>
>>
>>
>>
>>
>> *TimeoutMonitor'.[22/Jun/2016:17:11:29] ENGINE Error in 'start' listener 
>> >Traceback (most recent call last):File 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy.process.wspbus", 
>> line 203, in publishFile 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy.cpserver", 
>> line 167, in startFile 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy._cpserver", 
>> line 158, in httpserver_from_selfFile 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy._cpwsgi_server", 
>> line 60, in __init*
>> File 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy.wsgiserver.wsgiserver2", 
>> line 2208, in get_ssl_adapter_class
>> ImportError: No module named ssl_builtin
>>
>> [22/Jun/2016:17:11:29] ENGINE Shutting down due to error in start 
>> listener:
>> Traceback (most recent call last):
>> File 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy.process.wspbus", 
>> line 241, in start
>> File 
>> "/home/run_pyinstaller/pyins/build/sss/out00-PYZ.pyz/cherrypy.process.wspbus", 
>> line 221, in publish
>> ChannelFailures: ImportError('No module named ssl_builtin',)
>>
>>
>> Has anyone encountered issues with pyinstaller + cherrypy + ssl?
>>
>> PS: Filed an issue on the cherrypy project 
>> https://github.com/cherrypy/cherrypy/issues/1448
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "cherrypy-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cherrypy-user...-/[email protected] <javascript:>.
>> To post to this group, send email to cherryp...-/[email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/cherrypy-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.