try import except want lineno from Exception
neal at metaslash.com
Thu Sep 19 15:14:42 CEST 2002
On Thu, 19 Sep 2002 00:23:39 -0400, Ben Gerblich wrote:
> I am importing module files, and want to catch an error (if any) and
> print the filename and line number of the error. The "Exception ,e" does
> not return, or does not have the attirbutes listed above. It only
> returns e="line() takes exactly 2 arguments (3 given)"
See inspect.getfile() and inspect.getlineno().
You will need a frame which you can get from sys.exc_info()
More information about the Python-list