error with neic client?

I'm getting a new error with obspy.neic since the upgrade to 0.10.1:

from obspy.neic import Client
client = Client(host,port)
indivSta = client.getWaveform('HV', 'NPT', '', 'HHN',
UTCDateTime(2015, 3, 4, 22, 0), UTCDateTime(2015, 3, 5, 2, 0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/neic/",
line 121, in getWaveform
    seedname = network.ljust(2, " ") + station.ljust(5, " ") + channel + \
TypeError: must be char, not unicode

Here is proof of the version:
print obspy.__version__

Coding in is utf-8 in the script that uses the NEIC client.

Please advise on how to fix the problem.


This looks like a real bug, a regression from Py3 support? Could you file an issue?
Have you the possibility to test on Python 3 as well?

As a quick fix you can use the following:

(1) ask explicitly for unicore literals (the u in front of the strings):

indivSta = client.getWaveform(u'HV', u'NPT', u'', u'HHN',
UTCDateTime(2015, 3, 4, 22, 0), UTCDateTime(2015, 3, 5, 2, 0))

(2) use the following import towards the beginning of your script to use unicode literals as default. However, this might break your script elsewhere.

from __future__ import (unicode_literals)

Hope this helps!

Will file an issue. To close out this thread, the same error doesn't
occur using Python3.4.


Dear Weston,
I noticed that a ticket on this has already been filed by one of the developers:

Just comment there if you have some details to add.

Thanks for reporting!