diff --git a/python/MDSplus/mdsscalar.py b/python/MDSplus/mdsscalar.py index 4ea9de1558..f086341c19 100644 --- a/python/MDSplus/mdsscalar.py +++ b/python/MDSplus/mdsscalar.py @@ -33,6 +33,7 @@ def _mimport(name, level=1): import numpy as _N import ctypes as _C +import sys _dat = _mimport('mdsdata') _arr = _mimport('mdsarray') @@ -434,7 +435,10 @@ def _descriptor(self): def fromDescriptor(cls, d): if d.length == 0: return cls('') - return cls(_N.array(_C.cast(d.pointer, _C.POINTER((_C.c_byte*d.length))).contents[:], dtype=_N.uint8).tostring()) + if sys.version_info.major == 2: # needed for rhel7 and ubuntu14 + return cls(_N.array(_C.cast(d.pointer, _C.POINTER((_C.c_byte*d.length))).contents[:], dtype=_N.uint8).tostring()) + else: + return cls(_N.array(_C.cast(d.pointer, _C.POINTER((_C.c_byte*d.length))).contents[:], dtype=_N.uint8).tobytes()) def __radd__(self, y): """radd: x.__radd__(y) <==> y+x