Opened 3 years ago

Last modified 3 years ago

#32978 closed Cleanup/optimization

Provide more informative error message on loaddata/dumpdata --format yaml when PyYAML not installed — at Initial Version

Reported by: Brad Owned by: nobody
Component: Core (Serialization) Version: 3.2
Severity: Normal Keywords: serializers, yaml, dumpdata, loaddata
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

While the docs at https://docs.djangoproject.com/en/3.2/topics/serialization/#serialization-formats do mention that PyYAML is required for the yaml serializer, ./manage.py dumpdata|loaddata --format yaml, provides quite a sparse error message, "Unable to serialize database: module yaml not found" (from here: https://github.com/django/django/blob/fbb1984046ae00bdf0b894a6b63294395da1cce8/django/core/management/commands/dumpdata.py#L245) if PyYAML is not installed.

This could be especially confusing for new Django developers who are not aware that yaml is pointing to the PyYAML project on PyPI and is not a part of Django. Since yaml is the only one of the four serializers requiring an add-on third party package, it may be helpful to provide a more verbose error in this case.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top