Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the routes Dispatcher broken in CherryPy for Mac?

Is CherryPy broken? I just set it up and tried to use the routes dispatcher but it has an import error, my code is as follows:

import cherrypy

mapper = cherrypy.dispatch.RoutesDispatcher()

The error is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jwesonga/environments/cherrypy/lib/python2.6/site-packages/CherryPy-3.2.2-py2.6.egg/cherrypy/_cpdispatch.py", line 463, in __init__
    import routes
ImportError: No module named routes

I'm on a Mac and I tried both 3.2.2 and 3.0 using virtualenv for the latter.

like image 455
jwesonga Avatar asked Nov 30 '11 13:11

jwesonga


1 Answers

I have successfully used CherryPy with the routes dispatcher under OS X.

The error you've shown is:

ImportError: No module named routes

This is pretty clear -- Python can't find the routes modules. Have you installed it? This is not part of CherryPy, it's a separate module that you will need to install. If you're using MacPorts, you should be able to:

port install py-routes

(Or py25-routes or py26-routes depending on which Python you're using). If you're using virtualenv, you can simply run:

easy_install routes
like image 68
larsks Avatar answered Oct 18 '22 12:10

larsks