diff --git a/openmc/data/ace.py b/openmc/data/ace.py index 1a56c165ef..03052bcabc 100644 --- a/openmc/data/ace.py +++ b/openmc/data/ace.py @@ -16,7 +16,6 @@ generates ACE-format cross sections. """ from __future__ import division, unicode_literals -import io from os import SEEK_CUR import struct import sys @@ -164,7 +163,7 @@ class Library(object): # Determine whether file is ASCII or binary try: - fh = io.open(filename, 'rb') + fh = open(filename, 'rb') # Grab 10 lines of the library sb = b''.join([fh.readline() for i in range(10)]) @@ -173,13 +172,13 @@ class Library(object): # No exception so proceed with ASCII - reopen in non-binary fh.close() - fh = io.open(filename, 'r') - fh.seek(0) - self._read_ascii(fh, table_names, verbose) + with open(filename, 'r') as fh: + fh.seek(0) + self._read_ascii(fh, table_names, verbose) except UnicodeDecodeError: fh.close() - fh = open(filename, 'rb') - self._read_binary(fh, table_names, verbose) + with open(filename, 'rb') as fh: + self._read_binary(fh, table_names, verbose) def _read_binary(self, ace_file, table_names, verbose=False, recl_length=4096, entries=512): diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index c2e1b24109..62b02048be 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -456,7 +456,7 @@ class Reaction(object): # YIELD AND ANGLE-ENERGY DISTRIBUTION # Determine multiplicity - ty = ace.xss[ace.jxs[5] + i_reaction - 1] + ty = int(ace.xss[ace.jxs[5] + i_reaction - 1]) rx.center_of_mass = (ty < 0) if i_reaction < ace.nxs[5] + 1: if ty != 19: diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 9f55941389..8ff83482e5 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -3,8 +3,9 @@ module nuclide_header use, intrinsic :: ISO_FORTRAN_ENV use, intrinsic :: ISO_C_BINDING - use hdf5 - use h5lt, only: h5ltpath_valid_f + use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5iget_name_f, h5gget_info_f, & + h5lget_name_by_idx_f, H5_INDEX_NAME_F, H5_ITER_INC_F + use h5lt, only: h5ltpath_valid_f use constants use dict_header, only: DictIntInt diff --git a/src/reaction_header.F90 b/src/reaction_header.F90 index 185945563d..055dcb3923 100644 --- a/src/reaction_header.F90 +++ b/src/reaction_header.F90 @@ -1,6 +1,7 @@ module reaction_header - use hdf5 + use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5gget_info_f, h5lget_name_by_idx_f, & + H5_INDEX_NAME_F, H5_ITER_INC_F use constants, only: MAX_WORD_LEN use hdf5_interface, only: read_attribute, open_group, close_group, &