简体   繁体   English

python语法错误:非ascii字符

[英]python syntax error : non-ascii character

Hi I'm trying understand why I'm getting this error. 嗨,我正在尝试了解为什么会出现此错误。

when I deploy my project on google appengine, getting error like below 当我在Google Appengine上部署项目时,出现如下错误

SyntaxError: Non-ASCII character '\\xea' in file /base/data/home/apps/s~frikijihyo/1.377756632466273994/app/controllers.py on line 32, but no encoding declared; 语法错误:第32行上的文件/base/data/home/apps/s~frikijihyo/1.377756632466273994/app/controllers.py中的非ASCII字符'\\ xea',但未声明编码; see http://www.python.org/peps/pep-0263.html for details 有关详细信息,请参见http://www.python.org/peps/pep-0263.html

my code: python 我的代码:python

    # -*- coding: utf-8 -*-

    flash(u'Korean 게시글을 작성했습니다.', 'success')
    return redirect(url_for('article_list'))

i wrote coding: utf-8 . 我写了coding: utf-8

what is 'character \\xea'? 什么是“字符\\ xea”? how can i solve this problem? 我怎么解决这个问题?

what is 'character \\xea'? 什么是“字符\\ xea”?

\\xea is the first byte of the utf-8 encoding of '게' . \\xea是utf-8编码'게'的第一个字节。 It is the first non-ASCII byte in your source-code file. 它是源代码文件中的第一个非ASCII字节。

how can i solve this problem? 我怎么解决这个问题?

Ensure that the "coding" comment is on one of the first two lines of the file. 确保“编码”注释位于文件的前两行之一。 If the comment appears anywhere else, it has no effect. 如果注释出现在其他任何地方,则无效。

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

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