I am wondering if python has its error report message equivalent to $! in perl ?
Anyone who could give me an answer will be greatly appreciated.
Added:
example% ./test
File "./test", line 7
test1 = test.Test(dir)
^
SyntaxError: invalid syntax
When Exception occurs, I got something like this. If I apply try and catch block,
I can catch it and use sys.exit(message) to log the message. But, is there any chance
that I can get the string SyntaxError: invalid syntax and put it in message
Python generally uses exceptions to report errors. If some OS operation returns an error code, it raises an exception that you catch in a try-except block. For OS operations, that is OSError. The errno is contained in the exception instance.
Output: