幽门特错误或没有指定的编码

发布于 2025-02-11 04:07:10 字数 349 浏览 1 评论 0原文

我正在维护Python代码库。库中的所有模块之一都可以通过孔道奔跑,没有问题。

为此,一个模块pylint返回错误f0010。

< some_module> .py:1:[f0010(parse-error),]代码解析时出错:错误或没有指定的编码为< lose_module> .py

我盯着代码数小时,我看不到相当特别的东西。没有什么可以与图书馆中其他模块的任何实质性的方式对我有所不同。文件名,标题,页脚都非常相似,PEP8等。

有人有任何提示用于调试此错误吗?

如果没有其他东西,我想拥有一个孔分数,以便我可以以当前形式证明其存在是合理的,而且我真的不想从头开始重写它以安抚皮特。

I'm maintinaing a library of python code. All bar one of the modules in the library runs through pylint with no problems.

For this one module pylint returns error F0010.

<some_module>.py:1: [F0010(parse-error), ] error while code parsing: Wrong or no encoding specified for <some_module>.py

I've stared at the code for hours and I can't see quite what's so special about it. There is nothing that jumps out at me as being different in any substantial way to the other modules in the library. File names, headers, footers are all very similar, PEP8 etc etc.

Does anyone have any hints for debugging this error?

If nothing else I'd like to have a pylint score for it so I can justify its existence in its current form, and I really don't want to rewrite it from scratch to appease pylint.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅一夜美梦 2025-02-18 04:07:10

原来我设法解决了这个问题。

谁将其上次保存为ANSI,而不是UTF-8。

感谢您的指示,因为我想检查的不是何处。当我希望看到它实际上编码的内容时,我发现了这一点,以回应上面的评论。我以为是UTF-8,因为库中的所有其他文件都是UTF-8,实际上,此处的所有文件都是UTF-8,除了这个文件,现在...

现在可以稍微提高其Pylint评分。

Turns out I've managed to fix the problem.

Whoever edited it last saved it as ANSI rather than UTF-8.

Thanks for the pointers, as its not somethign I would have thought of checking. I found this out when I was looking to see what it was actually encoded as, in response to the comments above. I'd have assumed it was UTF-8 as all the other files in the library are UTF-8, in fact everything here is utf-8, apart from this one file...

Now to up its pylint score a bit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文