Search code examples
pythonimportimporterrorbottlegeturl

python2.7: Could not import get_url from bottle


I can't import the get_url from bottle:

from bottle import get_url

The error is:

Traceback (most recent call last):
  File "./py_test.py", line 4, in <module>
    from bottle import get_url
ImportError: cannot import name get_url

There is no error when I load any other one like: run, post, get, route, view, static_file, template, ...


Solution

  • Bottle doesn't seem to expose a get_url function. It does have a url function, which wraps the Bottle.get_url method for the default application.