So I implemented the exception spcified and in testing it returns: DeprecationWarning: raising a string exception is deprecated
I am not to worried about depreciation warning however, out of curiosity, what would the better way be to handle this? Is there a way that (web site, help documentation, etc...) I would be able to find this? I am running this in Python 2.5 Diez B. Roggisch wrote: > [EMAIL PROTECTED] schrieb: > > I have taken the coments and think I have implemented most. My only > > Unfortunately, no. > > > question is how to use the enumerator. Here is what I did, I have tried > > a couple of things but was unable to figure out how to get the line > > number. > > > > def Xref(filename): > > try: > > fp = open(filename, "r") > > except: > > raise "Couldn't read input file \"%s\"" % filename > > You still got that I-catch-all-except in there. > This will produce subtle bugs when you e.g. misspell a variable name: > > filename = '/tmp/foo' > try: > f = open(fliename, 'r') > except: > raise "can't open filename" > > > Please notice the wrong-spelled 'fliename'. > > This OTOH will give you more clues on what really goes wrong: > > > > filename = '/tmp/foo' > try: > f = open(fliename, 'r') > except IOError: > raise "can't open filename" > > > Diez -- http://mail.python.org/mailman/listinfo/python-list