Use errno
Former-commit-id: b1a8d1a27501cbd6fe57f42c5efa630862b60748
This commit is contained in:
parent
a63348d414
commit
3a1adeaa25
|
@ -14,7 +14,7 @@ cimport cython
|
||||||
from cython.parallel cimport parallel, prange
|
from cython.parallel cimport parallel, prange
|
||||||
import enum
|
import enum
|
||||||
import warnings
|
import warnings
|
||||||
|
import os
|
||||||
|
|
||||||
# Here will be enum and dtype definitions; maybe move these to a separate file
|
# Here will be enum and dtype definitions; maybe move these to a separate file
|
||||||
class VSWFType(enum.IntEnum):
|
class VSWFType(enum.IntEnum):
|
||||||
|
@ -1138,10 +1138,11 @@ cdef class TMatrixInterpolator:
|
||||||
qpms_load_scuff_tmatrix_crash_on_failure = False
|
qpms_load_scuff_tmatrix_crash_on_failure = False
|
||||||
self.spec = bspec
|
self.spec = bspec
|
||||||
cdef char * cpath = make_c_string(filename)
|
cdef char * cpath = make_c_string(filename)
|
||||||
if QPMS_SUCCESS != qpms_load_scuff_tmatrix(cpath, self.spec.rawpointer(),
|
retval = qpms_load_scuff_tmatrix(cpath, self.spec.rawpointer(),
|
||||||
&(self.nfreqs), &(self.freqs), &(self.freqs_su),
|
&(self.nfreqs), &(self.freqs), &(self.freqs_su),
|
||||||
&(self.tmatrices_array), &(self.tmdata)):
|
&(self.tmatrices_array), &(self.tmdata))
|
||||||
raise IOError("Could not read T-matrix from %s" % filename)
|
if (retval != QPMS_SUCCESS):
|
||||||
|
raise IOError("Could not read T-matrix from %s: %s" % (filename, os.strerror(retval)))
|
||||||
if 'symmetrise' in kwargs:
|
if 'symmetrise' in kwargs:
|
||||||
sym = kwargs['symmetrise']
|
sym = kwargs['symmetrise']
|
||||||
if isinstance(sym, FinitePointGroup):
|
if isinstance(sym, FinitePointGroup):
|
||||||
|
|
Loading…
Reference in New Issue