dumpdata fails with crytpic error

51 views
Skip to first unread message

Bernd Wechner

unread,
Jun 1, 2018, 12:22:43 AM6/1/18
to Django users
Just tried this:

$ python3 manage.py dumpdata --format json --indent 4 > data.json
CommandError: Unable to serialize database: 'NoneType' object has no attribute 'is_authenticated'

Anyone seen this before. How does one diagnose this given the vague nature of the message? I mean I presume it's complaining because there's an illegal value in a field in the database. But you think it's mention which field in which model on which record? Is there a quick way to find out?

Regards,

Bernd.

Mike Dewhirst

unread,
Jun 1, 2018, 2:10:47 AM6/1/18
to django...@googlegroups.com
On 1/06/2018 2:22 PM, Bernd Wechner wrote:
> Just tried this:
>
> |
> $ python3 manage.py dumpdata --format json --indent 4>data.json
> CommandError:Unableto serialize database:'NoneType'objecthas
> noattribute 'is_authenticated'
> |
>
> Anyone seen this before. How does one diagnose this given the vague
> nature of the message? I mean I presume it's complaining because
> there's an illegal value in a field in the database. But you think
> it's mention which field in which model on which record? Is there a
> quick way to find out?

I haven't seen it before but I would say it is your user model.
is_authenticated is an attribute of django.contrib.auth.user (actually
AbstractUser I think).

Don't know whether --verbosity=2 would give you more error info.

Here is mine which does work ...

python manage.py dumpdata --settings=proj.settings.dev --indent=2
--verbosity=0 --natural-primary --natural-foreign --all > dump.json

Note the settings arg which is required for manage.py to find the
correct database if you don't have DJANGO_SETTINGS_MODULE established in
your environment.

Mike

>
> Regards,
>
> Bernd.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/32b8f2a7-cbe2-420d-baee-5101e00a7038%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/32b8f2a7-cbe2-420d-baee-5101e00a7038%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Melvyn Sopacua

unread,
Jun 1, 2018, 6:14:51 AM6/1/18
to django...@googlegroups.com
On vrijdag 1 juni 2018 06:22:43 CEST Bernd Wechner wrote:

> Anyone seen this before. How does one diagnose this given the vague nature
> of the message?

Using the --traceback flag.

--
Melvyn Sopacua

Bernd Wechner

unread,
Jun 1, 2018, 7:20:34 AM6/1/18
to Django users
All sorted, thanks for the tips.

Bernd Wechner wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/A6pI5pwvMpA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages