bottle icon indicating copy to clipboard operation
bottle copied to clipboard

CherryPy server issue

Open soumendrak opened this issue 7 years ago • 5 comments

Throws the following exception while running on cherrypy server.

C:\Users\username\AppData\Local\Continuum\Anaconda2\lib\pkgutil.py:186: ImportWarning: Not importing directory 'C:\Users\username\AppData\Local\Continuum\Anaconda2\lib\site-packages\paste': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
C:\Users\username\AppData\Local\Continuum\Anaconda2\lib\pkgutil.py:186: ImportWarning: Not importing directory 'c:\users\username\appdata\local\continuum\anaconda2\lib\site-packages\paste': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
Traceback (most recent call last):
  File "server.py", line 9, in <module>
    run(host='localhost', port='8080', server='cherrypy', debug=True)
  File "C:\Users\username\AppData\Local\Continuum\Anaconda2\lib\site-packages\bottle.py", line 3127, in run
    server.run(app)
  File "C:\Users\username\AppData\Local\Continuum\Anaconda2\lib\site-packages\bottle.py", line 2787, in run
    from cherrypy import wsgiserver
ImportError: cannot import name wsgiserver

As per the link in CherryPy github, the import should be changed to

try:
    from cheroot.wsgi import Server as WSGIServer
except ImportError:
    from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer

soumendrak avatar May 27 '17 04:05 soumendrak

I am not sure it is an issue, in the last version 0.13 dev on github you have to use cheroot adapter instead of cherrypy. If you are using cherrypy >0.9 the later will fail, but the former will work. I think it is still in the code for retro compatibility reasons with old cherrypy (but not sure if this is needed).

pepelisu avatar May 29 '17 15:05 pepelisu

There hasn't been a release in over a year now meaning there's still no stable release with those changes (mainly switching over to Cheroot). Is there any timeline on the next release?

iloveluce avatar Mar 06 '18 21:03 iloveluce

Looks like a duplicate of #934 to me.

hartwork avatar Apr 06 '18 21:04 hartwork

line 3271 fixed for me:

        # from cherrypy   import           wsgiserver                                  # This will fail for CherryPy >= 9                                   ###    TODO
        from cheroot.wsgi import Server as WSGIServer
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server =              WSGIServer(**self.options)  ################# ###     wsgiserver.CherryPyWSGIServer(**                  WSGIServer.CherryPyWSGIServer(**

dimyme avatar Oct 14 '18 21:10 dimyme

@soumendrak Unfortunately, it's not working for Bottle 0.12.19.

mrdc avatar Dec 10 '20 16:12 mrdc