Sunday, December 30, 2012

Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

I've also tried changing the charset and collation options in my MySQL tables. Still no good. I'm so stumped. Can anyone help me, please?

On Sunday, December 30, 2012 8:54:44 PM UTC-5, Sam Raker wrote:
I tried changing my backend to django-mysql-pymysql (http://pypi.python.org/pypi/django-mysql-pymysql/0.1), and that didn't work either. I'm really at my wits' end. Can anyone help?

On Sunday, December 30, 2012 4:21:57 PM UTC-5, Sam Raker wrote:
I just tried both of those things, and the YAML data loaded fine, and validate said I had 0 errors.

Any other suggestions? I'm really stumped here.

On Sun, Dec 30, 2012 at 3:35 PM, donarb <donarb@nwlink.com> wrote:


On Sunday, December 30, 2012 11:58:46 AM UTC-8, Sam Raker wrote:
So I upped the verbosity like you said, and basically all it got me was a bunch of text telling me all the places Django didn't find my fixture before it finally did, and then the same error. Here's the full text of the error:

Traceback (most recent call last):
  File "/home/menusadmin/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 190, in handle
    for obj in objects:
  File "/home/menusadmin/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/django/core/serializers/pyyaml.py", line 62, in Deserializer
    raise DeserializationError(e)
DeserializationError: maximum recursion depth exceeded while calling a Python object

I tried changing commit to False in loaddata.py, I tried adding a manager class to the one model I have that another model refers to with a natural key (e.g., 'name,' a CharField, as opposed to the primary key). I read something about loaddata having some unicode-related problems, so I added custom Manager classes for all my models that coerce appropriate fields to strings, e.g.:

class MenuManager(models.Manager):
def create_Menu(self,restaurant,year,location,status,pk,period,language):
menu = self.create(restaurant=str(restaurant),year=int(year),location=str(location),status=str(status),pk=int(pk),period=str(period),language=str(language))
return menu

I'm still getting the exact same error. Help?
 
Then the next thing I'd do is to test the yml data itself, separate from Django to make sure that the data is not corrupted in any way. Run a script like this, if it passes, then you probably have some sort of error in your models that is recursive.

#!/usr/bin/env python

import yaml

stream = open("test.yml", "r")
print yaml.load(stream)

Finally, I'd run

./manage.py validate

to make sure that all of your models are valid.

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WoMoRX8i3DsJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/hTw0AXF02WEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment