mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #403 from smharper/pyapi-without-h5
Allow Python API to be used without h5py Conflicts: openmc/summary.py
This commit is contained in:
commit
286b0eabe6
1 changed files with 5 additions and 6 deletions
|
|
@ -2,12 +2,6 @@ import numpy as np
|
|||
|
||||
import openmc
|
||||
|
||||
try:
|
||||
import h5py
|
||||
except ImportError:
|
||||
msg = 'Unable to import h5py which is needed by openmc.summary'
|
||||
raise ImportError(msg)
|
||||
|
||||
|
||||
class Summary(object):
|
||||
"""Information summarizing the geometry, materials, and tallies used in a
|
||||
|
|
@ -16,6 +10,11 @@ class Summary(object):
|
|||
"""
|
||||
|
||||
def __init__(self, filename):
|
||||
# A user may not have h5py, but they can still use the rest of the
|
||||
# Python API so we'll only try to import h5py if the user actually inits
|
||||
# a Summary object.
|
||||
import h5py
|
||||
|
||||
openmc.reset_auto_ids()
|
||||
|
||||
if not filename.endswith(('.h5', '.hdf5')):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue