I have an extensive program that is running on my server. The line with the error looks like the following:
result[0].update(dictionary)
result[0]
looks like ("label",{key:value,...})
so I got an error saying that a tuple
does not have update
when I fixed it to be result[0][1].update(dictionary)
, I got the same error!
I then added print "test"
above to see what happened, and I got the same error, but it gave me the error occurring at the print statement. This tells me that the code the server is running is the original and not the edited one. I tried restarting the server. I have saved my code. I do not understand why nor how this is happening. What could be causing this and how can I make it so that the server recognizes the newer version?
error message
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/background_task/tasks.py", line 160, in run_task
tasks.run_task(task.task_name, args, kwargs) [2/1832]
File "/usr/local/lib/python2.7/dist-packages/background_task/tasks.py", line 45, in run_task
task.task_function(*args, **kwargs)
File "/.../proj/tasks.py", line 10, in automap_predict
automap_obj.predict()
File "/.../proj/models.py", line 317, in predict
prediction = predictions[1]
File "/.../proj/models.py", line 143, in predict
#this is a recursive call
File "/.../proj/models.py", line 143, in predict
#this is a recursive call
File "/.../proj/models.py", line 127, in predict
#result[0].update(dictionary) this happens at the base case of the recursion
AttributeError: 'tuple' object has no attribute 'update'
notice that I am getting this error on a line that is commented out. Displaying that this is not the code that is really running.
view
def view(request,param):
run_background_task(param)
return redirect("project.view.reload")
background_task
@background(schedule=0)
def run_background_task(param):
obj = MyModel.objects.get(field=param)
obj.predict()
predict function
This is where the result
gets created. I am not permitted to show this code, but note that I am sure that the actual code is irrelevant. It was working. I changed it to make a quick update. I got an error. I then fixed the error, but proceeded to get the same error. I even went back to the old version that was working and I still get the same error. Therefor this error has nothing to do with the contents of this function.
Let me know if I can be of any more help.