I'm running into a strange situation simply running a script from the command-line: when I run into errors, often the traceback given contains code that makes no sense. Every line in the traceback should be a method call, but sometimes they aren't. Also, the lines referenced in the traceback don't correspond to the given error. What's happening? As an example, here is a simple error where numpy
wasn't imported, but the traceback makes little sense and refers to unrelated code lines:
Traceback (most recent call last):
File "bin/train_global_model.py", line 549, in <module>
if __name__ == '__main__':
File "bin/train_global_model.py", line 236, in main
def main():
File "bin/train_global_model.py", line 407, in do_training
tb_writer=train_writer,
File "bin/train_global_model.py", line 200, in run_iteration
print(accuracy)
NameError: global name 'np' is not defined
Pay special attention to the code lines referenced.
Is python caching code that is executed somewhere but then referring to the actual file when it's tracing an exception? Running Python 2.7.13.