reduced the frequency of h5py complaints to once every 2h
This commit is contained in:
parent
fb0439bf44
commit
2fb97df16c
|
@ -1,7 +1,13 @@
|
|||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
"""Main aggregator"""
|
||||
import os,sys
|
||||
import os,sys,time
|
||||
|
||||
h5py_flag = os.path.join(os.path.dirname(__file__),'../../.noH5py')
|
||||
h5py_grace = 7200 # only complain once every 7200 sec (2 hours)
|
||||
h5py_msg = "h5py module not found."
|
||||
|
||||
now = time.time()
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f:
|
||||
version = f.readline()[:-1]
|
||||
|
@ -9,9 +15,18 @@ with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f:
|
|||
from .environment import Environment # noqa
|
||||
from .asciitable import ASCIItable # noqa
|
||||
try:
|
||||
from .h5table import H5Table # noqa
|
||||
from .h5table import H5Table # noqa
|
||||
if os.path.exists(h5py_flag): os.remove(h5py_flag) # delete flagging file on success
|
||||
except ImportError:
|
||||
sys.stderr.write("h5py module not found")
|
||||
if os.path.exists(h5py_flag):
|
||||
if now - os.path.getmtime(h5py_flag) > h5py_grace: # complain (again) every so-and-so often
|
||||
sys.stderr.write(h5py_msg+'\n')
|
||||
with open(h5py_flag, 'a'):
|
||||
os.utime(h5py_flag,(now,now)) # update flag modification time to "now"
|
||||
else:
|
||||
open(h5py_flag, 'a').close() # create flagging file
|
||||
sys.stderr.write(h5py_msg+'\n') # complain for the first time
|
||||
|
||||
from .config import Material # noqa
|
||||
from .colormaps import Colormap, Color # noqa
|
||||
from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa
|
||||
|
|
Loading…
Reference in New Issue