在Windows上运行“lektor server”命令时出现问题

2024-04-20 02:29:05 发布

您现在位置:Python中文网/ 问答频道 /正文

Python版本:2.7

lektor server命令上显示以下错误:

Traceback (most recent call last):
  File "/Users/item4/Projects/lektor/lektor/devserver.py", line 49, in build
    builder.prune()
  File "/Users/item4/Projects/lektor/lektor/builder.py", line 1062, in prune
    for aft in build_state.iter_unreferenced_artifacts(all=all):
  File "/Users/item4/Projects/lektor/lektor/builder.py", line 371, in iter_unreferenced_artifacts
    and is_primary_source''', [artifact_name])
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Tags: inpybuildbuilderlinealluserslektor
1条回答
网友
1楼 · 发布于 2024-04-20 02:29:05

最后我得到了答案。可能有用

我编辑过/Users/item4/Projects/lektor/lektor/生成器.py加了一行

con.text_factory = lambda x: unicode(x, 'utf-8', 'ignore')

在下一行之后

con = sqlite3.connect(self.buildstate_database_filename,
                              timeout=10, check_same_thread=False)

参考链接:http://hakanu.net/sql/2015/08/25/sqlite-unicode-string-problem/

相关问题 更多 >