Dig Through More Errors
So my suggestion here would be that we focus on the
load_model() function and therefore, at least for now, remove the
except from the
main() and just have the
load_model() call in line 22 and remove the rest for now. Yeah, because the question is about exceptions and how to see, like, exceptions bubble up in the stack trace basically, that if an exception occurs in a called function, that it would also show up in the stack trace, like, inside of the calling function is kind of like what this person is asking about. So we don’t really want to catch the exception here. Right.
And like Philipp suggested, so let’s just get rid of this
except for now. Exactly. I move this in. And then this predictions, this variable, we don’t have it, it doesn’t add anything here, so I’m just going to remove it for now. Yeah.
I’m just going to replace it with little
print() statement so that we know when everything runs and then ends up being done. Yeah, but the
TypeError that you’re receiving is that currently in line 22 we try to define
model as a return from
load_model() doesn’t return two things. Right?
If we want to unpack this error message here, we’ve got the keyword here that tells us that it’s trying to unpack something, which is happening here on line 22, where it’s expecting a returned iterable, like a tool for example, but it’s really just getting a dictionary in these
return statements here.
Like, we have two
return statements in
load_model(), and both of them return a dictionary. So this unpacking is not going to work and like Philipp suggests, good idea—I’m just going to remove that for now and just keep it as a, just as a call, because we’re looking at the exceptions in here, so we don’t really need to do anything with the
return value that anyways doesn’t work.
Become a Member to join the conversation.