M
M
Maxim Dunayevsky2015-09-28 14:42:02
Django
Maxim Dunayevsky, 2015-09-28 14:42:02

Python: works under the debugger, but in production - an error. Have you seen this?

Hello!
I am writing part of the API of a large system, everything is under the NDA, so I will not show the sorts. But the problem is this:

  • there are several entities of the same type
  • the same type of API is written for everyone, the only difference is in the names of models and serializers
  • all parts except one work perfectly as intended
  • one part gives error 500: 'tuple' object has no attribute '_meta'
  • but if you run under a debugger, for example, pdb, then everything works as it should

Who faced similar? What to do?
I write API on Django REST Framework , almost everything is done through ModelViewSet .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey K, 2015-09-28
@mututunus

Somewhere you have an extra comma at the end of the line.

U
un1t, 2015-09-28
@un1t

I suspect that get_or_create is used somewhere, it returns two tuples from the object and created, and you assign the result to one variable, the tuple is in the variable, not the model object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question