I'm using Django that iterate through items to see if they exists using get_or_create. Right now I'm having this problem
def insert_titles(self):
game = None
title = None
for k,v in self.data.items():
game_exists = Game.objects.all().get_or_create(game_name=v['title']) #will get RuntimeError: maximum recursion depth exceeded in cmp
print game_exists
Basically, this is an script that will run as a cron job, so I kind of have to iterate through a bunch of items to get to the point I want
while True:
try:
data = strategy.process()
filter = FilterGames(data, link)
Filter Games code:
def __init__(self, data):
self.data = data
self.insert_titles()
print "init"
I've done this in the past with Play Framework, maybe since I'm still inexperienced in Python I'm looking at it the wrong way, not sure how to proceed when it gives me this type of error. I have tried change the structure a bit to no avail. Weird thing is that if I use a string
in game_name
it will work as expected, but if I use data gathered from a loop, it starts throwing that error.
Finally, I want to know how to correct this type of error, and hopefully understand a bit more of why it does that.