SD2E / opil

The Open Protocol Interface Language (OPIL) is intended as a standard language for protocol interfaces
5 stars 1 forks source link

AttributeError when writing opil to string #193

Open tramyn opened 2 years ago

tramyn commented 2 years ago

I have an opil document I would like to write to string. I have tried using this test function as a guideline to write out sample opil data but got the following error:

python3.8/site-packages/sbol3/document.py", line 303, in write_string
    return result.decode()
AttributeError: 'str' object has no attribute 'decode'

Here is a snippet of code that can be used to reproduce this error:

from opil import *
from sbol3 import set_namespace, TextProperty, Measure, Component, TopLevel, SBOL_TOP_LEVEL
sbol.set_namespace('http://example.org')

doc = Document()
protocol = ProtocolInterface('protocol')
param = Parameter()
doc.add(protocol)
protocol.has_parameter = [param]
doc.write_string('nt')

Additional info: I am using opil==1.0b5.post2

tramyn commented 2 years ago

I did some debugging and this error is caused by using an old sbol3 release. If opil is using sbol3==1.0a8, then this AttributeError can be reproduced. But if I update Intent Parser to use sbol3==1.0b6, then this issue disappears.

Could I request a new build for opil to use sbol3==1.0b6?