简体   繁体   中英

Flask Syntax Error: Non-ASCII character '\xe2'

I'm new to Flask and I'm trying to go through introductory tutorials( here ). I simply copy and paste the code and do the steps

SyntaxError: Non-ASCII character '\xe2' in file main.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Indeed, I opened the link in the error and googled the error and checked few search items but I didn't get the clue.

It looks lie there is a problem with the syntax of this line

app.config[‘SQLALCHEMY_DATABASE_URI’] = ‘sqlite:///’ + os.path.join(basedir, ‘app.sqlite’)

My whole purpose is getting intoduced on how to use Flask and to CURD operation using SQLite database.

You're using the unicode character "right single quotation mark" (') as per http://www.fileformat.info/info/unicode/char/2019/index.htm

If you change this to use a normal single quote, it should work.

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'app.sqlite')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM