Opened 3 months ago
Last modified 3 months ago
#35819 closed Bug
sqlite3.ProgrammingError while python manage.py dumpdata > dump.json — at Version 1
Reported by: | DragonwolfAside | Owned by: | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 5.1 |
Severity: | Normal | Keywords: | dumpdata |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Python 3.12.4 Django 5.1.1
Having difficulty while dumping sql data with pipes
C:\Users\Admin\Desktop\Projects\django-project>python manage.py dumpdata > dump.json CommandError: Unable to serialize database: 'gbk' codec can't encode character '\xa0' in position 70: illegal multibyte sequence Exception ignored in: <generator object cursor_iter at 0x000001FA8E382020> Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\sql\compiler.py", line 2115, in cursor_iter cursor.close() sqlite3.ProgrammingError: Cannot operate on a closed database.
but following command runs well
C:\Users\Admin\Desktop\Projects\django-project>python manage.py dumpdata [{"model": "admin.logentry", "pk": 1, "fields": {"action_time": "2024-10-06T20:31:44.362", "user": 1, "content_type": 6, "object_id": "1", ...
chcp 65001 also didn't work, perhaps Chinese language system make the default encoding to gbk, leading to a serialize error, then the cursor closes.
Note:
See TracTickets
for help on using tickets.