SyntaxError in Flask while using Flash in python

I’m getting an error while i use flash,it’s like-

plabon@plabon-H110M-S2PV-DDR3:~/Desktop/flask$ python flaskblog.py
  File "flaskblog.py", line 40
    flash(f'Account created for {form.username.data}!','success')
                                                     ^
SyntaxError: invalid syntax


Can you please take a look in my code and help me to know where i am making mistakes?
I am giving all of my code in Ubuntu paste bin,
1)flaskblog.py
2)forms.py
3)register.html
4)layout.html
5)main.css
6)home.html
7)about.html

I am suspicious of the f at the start of your string.

I’m trying to learning flask by YouTube tutorial.I did what he did.Can you please take a look please.


I set this link on specific time.

What version of Python are you using?

i have installed Python 2.7.18rc1 and Python 3.8 both :frowning:

It looks like you’re trying to run python with points to Python 2. What happens if you use python3 .... in the command line?

If i run python3 in the command line it opens python 3.8.2 version.Is python 2 is default version here?Should i try to change this? :roll_eyes:

Did you run python3 flaskblog.py?

No,i didn’t before.But it shows like that.

I am not familiar with Flask, but I’d try installing the email validator next.

2 Likes

Woaooo :grin: :heart_eyes: :star_struck: :star_struck: :star_struck:
Thank you so much from bottom of my heart :sparkling_heart:
Everything working well now :grin:

1 Like