python manage.py dumpdata 无法序列化数据库
python manage.py dumpdata Unable to serialize database
我正在尝试 运行 命令
python manage.py dumpdata > data.json
然而,我收到这样的回溯:
CommandError: Unable to serialize database: 'charmap' codec can't encode characters in position 1-4: character maps to <undefined>
Exception ignored in: <generator object cursor_iter at 0x0000020E11353820>
Traceback (most recent call last):
File "C:\Users\Illia\Desktop\MyDjangoStuff\greatkart\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1625, in cursor_iter
cursor.close()
sqlite3.ProgrammingError: Cannot operate on a closed database.
如何解决这个问题?
运行 set PYTHONIOENCODING=utf-8
在 python manage.py dumpdata > data.json
之前解决了问题。
我正在尝试 运行 命令
python manage.py dumpdata > data.json
然而,我收到这样的回溯:
CommandError: Unable to serialize database: 'charmap' codec can't encode characters in position 1-4: character maps to <undefined>
Exception ignored in: <generator object cursor_iter at 0x0000020E11353820>
Traceback (most recent call last):
File "C:\Users\Illia\Desktop\MyDjangoStuff\greatkart\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1625, in cursor_iter
cursor.close()
sqlite3.ProgrammingError: Cannot operate on a closed database.
如何解决这个问题?
运行 set PYTHONIOENCODING=utf-8
在 python manage.py dumpdata > data.json
之前解决了问题。