Skip to content

Commit

Permalink
Add default message attribute
Browse files Browse the repository at this point in the history
The `message` attribute on ValueError has been deprecated since 2.6 and removed in Python 3. Explicitly add it ourselves for our subclasses. Fixes #2
  • Loading branch information
kstark authored Feb 9, 2022
1 parent e05d04e commit 8f5ef52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fwffr.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

PY3 = sys.version_info[0] == 3

__all__ = [
'FixedLengthError',
'FixedLengthUnknownRecordTypeError',
'FixedLengthSeparatorError',
Expand All @@ -26,6 +25,9 @@ def iteritems(d, **kw):

class FixedLengthError(ValueError):
""" Base class for parsing errors """

def __init__(self, message=None):
self.message = message

def __str__(self):
return self.message
Expand Down

0 comments on commit 8f5ef52

Please sign in to comment.