Join GitHub today
sqlite3.ProgrammingError with non-english attachments #243
Python version: 2.7.11
Let's make simple and same situation
(lektor) [item4@item4-mbp test]$ lektor server * Project path: /Users/item4/Projects/lektor/test/test.lektorproject * Output path: /Users/item4/Library/Caches/Lektor/builds/1d660b474e4a3c0330f4ce35b4827072 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) Started source info update Finished source info update in 0.23 sec Started build U index.html U about/index.html U projects/index.html U blog/index.html U static/style.css U blog/first-post/index.html U blog/first-post/미츠히코.txt Finished build in 0.07 sec Started prune Finished prune in 0.00 sec 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.
This is a bytestring/unicode problem, and one that's probably going to be difficult to fix. Bytestrings can't reliably handle characters outside of the ASCII character space, while unicode strings can. In Python 2.7, the
If you look in the
for dirpath, dirnames, filenames in os.walk(dst):
I don't have a good solution to this problem on Python 2, but if you can switch to Python 3, I would highly suggest doing so. I just tested this example on Python 2 and Python 3, and while I was able to reproduce the failure on Python 2, switching to Python 3 made it go away. Give it a try!
added a commit
Aug 12, 2016
I have edited /Users/item4/Projects/lektor/lektor/builder.py and added a single line
after the following line