import of protobuf fails in Jython 2.7.2
https://github.com/protocolbuffers/protobuf/blob/92e3d3e02a886839c75aca74dab4d0ea4cef8eb8/python/google/protobuf/internal/decoder.py#L92
from yamcs.client import YamcsClient Traceback (most recent call last): File "
", line 1, in File "/home/jython/jython2.7.2/Lib/site-packages/yamcs/client.py", line 4, in from google.protobuf import timestamp_pb2 File "/home/jython/jython2.7.2/Lib/site-packages/google/protobuf/timestamp_pb2.py", line 7, in from google.protobuf import reflection as _reflection File "/home/jython/jython2.7.2/Lib/site-packages/google/protobuf/reflection.py", line 51, in from google.protobuf import message_factory File "/home/jython/jython2.7.2/Lib/site-packages/google/protobuf/message_factory.py", line 49, in from google.protobuf.internal import python_message as message_impl File "/home/jython/jython2.7.2/Lib/site-packages/google/protobuf/internal/python_message.py", line 64, in from google.protobuf.internal import decoder File "/home/jython/jython2.7.2/Lib/site-packages/google/protobuf/internal/decoder.py", line 92, in _SURROGATE_PATTERN = re.compile(six.u(r'[\ud800-\udfff]')) File "/home/jython/jython2.7.2/Lib/site-packages/six.py", line 658, in u return unicode(s.replace(r'\', r'\\'), "unicode_escape") UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 1-7: illegal Unicode character
Jython doesn't support lone surrogates at all. According to https://bugs.jython.org/issue2048 that is by design.
We'd be happy to accept a PR to address this.
Another place where Jython hits this is in https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/json_format.py#L82
r'[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]'
Closing since I don't believe we actively support Jython. We're happy to accept PRs for a contributed fix though.
@AdamElliott-AB @rasantel hi guys, have you found a way to slove this?
Not I. I ended up reworking my architecture so Jython wasn't needed. This issue made it too much of a hassle for me.