Commit 4776df19 authored by W. Trevor King's avatar W. Trevor King
Browse files

Convert exception.message -> exception.args[0] for Python 3 compatibility.

Python 3 exceptions no longer have a .message attribute.
parent 5a636a00
...@@ -16,6 +16,7 @@ PTN003.ifn and TN003.ifn. ...@@ -16,6 +16,7 @@ PTN003.ifn and TN003.ifn.
from __future__ import absolute_import from __future__ import absolute_import
import io as _io import io as _io
import re as _re import re as _re
import sys as _sys
import numpy as _numpy import numpy as _numpy
...@@ -222,9 +223,9 @@ def load(filename, **kwargs): ...@@ -222,9 +223,9 @@ def load(filename, **kwargs):
try: try:
packed_experiment = _load(filename) packed_experiment = _load(filename)
except ValueError as e: except ValueError as e:
if e.message.startswith('not enough data for the next record header'): if e.args[0].startswith('not enough data for the next record header'):
raise IOError('invalid record header; bad pxp file?') raise IOError('invalid record header; bad pxp file?')
elif e.message.startswith('not enough data for the next record'): elif e.args[0].startswith('not enough data for the next record'):
raise IOError('final record too long; bad pxp file?') raise IOError('final record too long; bad pxp file?')
raise raise
return _convert(packed_experiment, **kwargs) return _convert(packed_experiment, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment