#32978: Provide more informative error message on loaddata/dumpdata --format 
yaml
when PyYAML not installed
-------------------------------------+-------------------------------------
     Reporter:  Brad                 |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Core (Management     |                  Version:  3.2
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  serializers,yaml,dumpdata,loaddata |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Brad:

Old 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.

New 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.

 For instance, something like. "Serializing to and from YAML requires the
 PyYAML package. Install PyYAML to use the YAML format."

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32978#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.4ece2b70fb0b722df3770c1756ef07f8%40djangoproject.com.

Reply via email to