views:

185

answers:

2

I have installed CherryPy 3.1.0,. Here is what happens when I try to run tutorial 9:

$ cd /Library/Python/2.5/site-packages/cherrypy/tutorial/
$ python tut09_files.py
Traceback (most recent call last):
  File "tut09_files.py", line 48, in <module>
    from cherrypy.lib import static
ImportError: cannot import name static

The previous line in the file:

import cherrypy

passes without error, so it appears that it can find cherrypy on the path. What am I missing?

+1  A: 

This works for me, and I'm also using CherryPy 3.1.0, so I'm not sure what to tell you.

Look in your /Library/Python/2.5/site-packages/cherrypy/lib directory for a file named static.py; if this file exists then I'm not sure what to tell you. If it doesn't then something has happened to your CherryPy and I'd advise you to reinstall. If it does then you should check the value of sys.path to make sure it's detecting the right version of CherryPy.

You can also try running the python interpreter on the command line and then doing a from cherrypy.lib import static to see if you get the same result.

Eli Courtwright
+1  A: 

I had an old CherryPy-2.3.0-py2.5.egg file in my site-packages. After removing the old .egg I could run the tutorial.

Justin Walgran