I am using this command to dump data
py -Xutf8 manage.py dumpdata app.ModelName --indent 4 --format=json --output app/fixtures/data.json
which works perfectly fine. However when I try to run the command in script
management.call_command(
"dumpdata",
indent=4,
format="json",
output=os.path.join(path, "app//fixtures//data.json"),
verbosity=1,
)
It ends up with this error:
django.core.management.base.CommandError: Unable to serialize database: 'charmap' codec can't encode characters in position 1-2: character maps to <undefined>
I have tried something like this yet it still doesn't work. Any solutions to this?