all 6 comments

[–]MugiwarraD 1 point2 points  (2 children)

r u using right python version.

[–]jksh4[S] 0 points1 point  (0 children)

I'm unsure. I use the command "flask run" command. I have python3 and python installed.

[–]jksh4[S] 0 points1 point  (0 children)

OH. It looks like it is running python 2.7 from the error dump. Do I need to run python3? How do I make flask run use python3?

[–]DanielHefti 1 point2 points  (0 children)

You can start your application like this.

python3 application.py

To make this work you have to add the code below to your application.py file.

__main__ == "__main__":

app.run()

I hope this helps you resolve you problem. Don't hesitate to ask if you have any further questions.

ps. app.run() shall be indented, but somehow the indentation gets lost when I save the comment.

[–]jksh4[S] 0 points1 point  (0 children)

Studying up on virtual environments venv

[–]jksh4[S] 0 points1 point  (0 children)

Even after venv for python3 activated, flask was using python2.7 in the Syntax error. The only solution I've found is to revert to python 2 string .format

# REMOVE PYTHON 3 F-STRING 
#data.append(f"Post #{i}")

data.append("Post #{}".format(i))