Dear obspy-ers:
We had some trouble getting obspyh5 going for python3 with the yum package of obspyh5 for fedora core 21:
from obspy import read
st = read()
st.write(‘test.h5’,‘H5’)
Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib64/python3.4/site-packages/obspy/core/stream.py”, line 1417, in write
writeFormat(self, filename, **kwargs)
File “/usr/lib/python3.4/site-packages/obspyh5-0.1.0-py3.4.egg/obspyh5.py”, line 169, in writeh5
trace2group(tr, group, **kwargs)
File “/usr/lib/python3.4/site-packages/obspyh5-0.1.0-py3.4.egg/obspyh5.py”, line 193, in trace2group
if isinstance(val, basestring) or _is_utc(val):
NameError: name ‘basestring’ is not defined
but replacing line 193 in obspyh5.py with:
if isinstance(val, str) or _is_utc(val):
(based on http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html)
and then a fresh:
python3 setup.py install
seems to have done the trick. After that, we only get a warning:
usr/lib/python2.7/site-packages/obspyh5-0.1.0-py2.7.egg/obspyh5.py:201: UserWarning: Writing header ‘response’ is not supported. Only h5py types and UTCDateTime are supported.
“types and UTCDateTime are supported.”) % key)
I checked, and with the new line 193, obspyh5 still works for python2, as well.
Regards,