The problem is in your deep_search
function - it doesn't always return anything. Consider for example what happens if operaciones_h(ini.get_datos())
returns an empty list: the for hijo in hijos
loop will never be entered. And even then, if all the datos are in visit
, the if
statement will never be True and you will never hit the return statement. In both of those cases, the value of deep_search
will be None
.
You should ensure that all paths through deep_search
end with returning a Nodo
object.