Forums

Flask demo for noobs has indent error?

Initially I couldn't get the Flask demo to run correctly - it gave a Syntax Error at Line 9 in the Editor, and an Unhandled Exception on the web page.

My handy 13-y/o son pointed out that the "return" was not indented, and when we fixed that it ran correctly.

Could be a feature of my Chromebook during Cut'n'Paste, but I thought you might like to know!

Which Flask demo is that?

Avansomeren is referring to the "I want to create a web application" helper task featured on the help page. It is the one repo'd here.

If you look at the code for step (I think it is step #10?) where you have to copy and paste in a block of code that begins

from flask import Flask, request, url_for

you'll see the function 'hello_person()' is defined but the next line with the return command is not indented. I didn't try running it myself, but it does look wrong.

def hello_person():
return """
    <p>Who do you want me to say "Hi" to?</p>
    <form method="POST" action="%s"><input name="person" /><input type="submit" value="Go!" /></form>
    """ % (url_for('greet'),)

I happen to be using Google Chrome browser at the moment, and so I don't know if that is related to his experience having the indenting be an issue on Chromebook.

Looks like the 'greet()' function has the same issue?

I see what you mean. That's definitely wrong. I'll get that fixed ASAP. Thanks for reporting it.

Not at all. Happy not to have made a complete fool of myself! :)

That's fixed. Sorry about the confusion.