eclipse 语法错误:以“\x82”开头的非 UTF-8 代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15602038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SyntaxError: Non-UTF-8 code starting with '\x82'
提问by Elmer
I get this error in Eclipse while working on "Byte of Python"
在 Eclipse 中处理“Python 字节”时出现此错误
It says the error shows up in 2 lines:
它说错误显示在 2 行中:
source = ["C:\My Documents", "C:\Code"]
and
和
zip_command = "zip -qr {0} {1}".format(target, ? ?.join(source))
I cant really figure out what im doing wrong here.
我真的无法弄清楚我在这里做错了什么。
Here's the full error:
这是完整的错误:
SyntaxError: Non-UTF-8 code starting with '\x82' on line x, but no encoding declared; see http://python.org/dev/peps/pep-0263/for details
语法错误:第 x 行以“\x82”开头的非 UTF-8 代码,但未声明编码;有关详细信息,请参阅http://python.org/dev/peps/pep-0263/
采纳答案by root
You are using chars (curved quotes) encoded in windows-1252
that cannot be decoded because it's not valid utf-8
. Replace the quotes and you are good to go.
您正在使用windows-1252
无法解码的字符(弯曲引号),因为它无效utf-8
。替换引号,您就可以开始了。