bottle
bottle copied to clipboard
CherryPy server issue
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
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).
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?
Looks like a duplicate of #934 to me.
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(**
@soumendrak Unfortunately, it's not working for Bottle 0.12.19.