1

I did the project in ex50. It works fine on ubuntu. However I can't get it run normally on win7. What's wrong with it? (My code is exactly the same as what it is in the book!)

app.py

import web
urls = (
   '/', 'Index'
)
app = web.application(urls, globals())

render = web.template.render('templates/')

class Index(object):
    def GET(self):
        greeting = "Hello World"
    return render.Index(greeting = greeting)

if __name__ == "__main__":
    app.run()

Traceback on win7:traceback And my project here on github~ https://github.com/ustcgcy/gothonweb

1 Answer 1

0

Don't use the trailing /on Windows. Instead of render = web.template.render('templates/') write render = web.template.render('templates').

3
  • I've modified it but the traceback still occurs.
    – blancmange
    Nov 21, 2015 at 13:28
  • Your problem is likely in the HTML template. Try saving it without BOM in an editor with this capability such as Notepad++. Nov 21, 2015 at 16:31
  • Actually I did use Notepad++ to edit the file and it is that format.
    – blancmange
    Nov 22, 2015 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.