GraceDb.voevents() method should fill text values in JSON structure with Unicode string, not bytes
The GraceDb.voevents()
method tries to fake the text
value in the JSON structure by filling it with the VOEvent file text, but it does this incorrectly by filling it with bytes. JSON does not support byte values, so this should be impossible. This breaks encoding assumptions that other codes make.
[2018-06-27 22:50:49,055: ERROR/ForkPoolWorker-65] Task gwcelery.tasks.circulars.create_circular[2838749b-738a-4d0c-b4dd-4a4241ac18c5] raised unexpected: AttributeError("'bytes' object has no attribute 'encode'",)
Traceback (most recent call last):
File "/home/lsinger/gwcelery/lib/python3.6/site-packages/celery/app/trace.py", line 382, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/lsinger/gwcelery/lib/python3.6/site-packages/celery/app/trace.py", line 641, in __protected_call__
return self.run(*args, **kwargs)
File "/home/lsinger/local/src/gwcelery/gwcelery/tasks/circulars.py", line 11, in create_circular
return ligo.followup_advocate.compose(graceid, client=gracedb.client)
File "/home/lsinger/gwcelery/lib/python3.6/site-packages/ligo/followup_advocate/__init__.py", line 47, in compose
root = lxml.etree.fromstring(voevent['text'].encode('utf8'))
AttributeError: 'bytes' object has no attribute 'encode'