Python Forum

Full Version: Tradeback Errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using Python 2.7x to coding some program. I have my own compile system that compile every arrays but the problem is when I do mistake inside any array, it gives traceback error. I know they are very understandable but I don't want to stop compile because if there are more than one error, you need to fix one by one because every time python see the error gives traceback and stop working. So is it possible while importing files if there is any error I want to print error on the batch and continue to compile.

Traceback (most recent call last):
  File "compile_id.py", line 30, in <module>
    from ids import *
  File "C:\Users\user\Desktop\Python Modding\ids.py", line 14877, in <module>
    (issPossibleInt, ":i"),
NameError: name 'issPossibleInt' is not defined
Note that: isPossibleInt is defined integer for me I just typed wrongly "iss" to show what I want to change. I want to change that error messages like;
Error: issPossibleInt is not defined in file id.py (Line: 30). (NameError)
and continue to progress on compile_ids.py until it loaded all the files and after I loaded all files, I want to listed all errors and give an Failed to compile error.

For example I want to see prints like:
Started to compiling compile_ids.py...
Error: issPossibleInt is not defined in file id.py (Line: 30). (NameError)
Error: issMyName is not defined in file ismyname.py (Line: 32). (NameError)
Error: blabla is not defined in file blabla.py (Line: 88). (NameError)
Failed to compile compile_ids.py.
So basically the question is; "Is there any way to block traceback errors to stop compiling while including other python files which includes arrays init and changing the error messages?"
I suppose if you knew where errors are occurring, you could capture each in try, except block, but what's the point?
Once you get a traceback error, your code is corrupt, so there's no way of knowing that anything is running properly after
the error occurred (all further processing may be corrupt as well).
Thanks I got my answer, I just wanted to know if there is any way to see if script running properly except traceback error but as you said it seems like impossible to know that.

Thanks for answer