Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python manage.py dumpdata Unable to serialize database

I am trying to run the command python manage.py dumpdata > data.json

However, I receive such a traceback:

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.


How to solve this issue?

like image 626
illymarev Avatar asked Oct 20 '25 03:10

illymarev


1 Answers

Running set PYTHONIOENCODING=utf-8 before python manage.py dumpdata > data.json has solved the issue.

like image 61
illymarev Avatar answered Oct 21 '25 16:10

illymarev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!