简体   繁体   English

Flask语法错误:非ASCII字符'\\ xe2'

[英]Flask Syntax Error: Non-ASCII character '\xe2'

I'm new to Flask and I'm trying to go through introductory tutorials( here ). 我是Flask的新手,我正在尝试入门教程( 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. 我的整个目的是介绍如何使用Flask以及如何使用SQLite数据库进行CURD操作。

You're using the unicode character "right single quotation mark" (') as per http://www.fileformat.info/info/unicode/char/2019/index.htm 您正在按照http://www.fileformat.info/info/unicode/char/2019/index.htm使用Unicode字符“右单引号”(')

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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