Search code examples
pythonmacoseasy-installbottle

Installing bottlepy and running python script


I am trying to run this simple python script through my terminal window:(it is the example on the bottlepy website)

from bottle import route, run, template

@route('/hello/:name')
def index(name='World'):
    return template('<b>Hello {{name}}</b>!', name=name)

run(host='localhost', port=8080)

In order to do so, I installed bottlepy from Terminal using

easy_install bottle

which instals it in /Library/Frameworks/Python.framework/Versions/4.2.30201/bin

When I try to run my python document in my terminal window:

cd ~/Dropbox/Work/MongoDB/
python hello.py

It returns:

ImportError: No module named bottle

I'm not sure what to do to put bottlepy in the correct emplacement so that it works. I'm sure it must be something silly but I can't think of what to do. Thank you!! xx


Solution

  • Take a look at the docs. You can download bottle.py directly to the folder with the rest of the progs, or install in the way shown.