String missing ending quote: %r
""" ParseError: When the wrong format data is found. """ text = self.token if len(text) < 1 or text not in _QUOTES: raise self.ParseError('Expected string but found: %r' % (text,)) if len(text) < 2 or text[-1] != text: raise self.ParseError('String missing ending quote: %r' % (text,)) try: result = text_encoding.CUnescape(text[1:-1]) except ValueError as e: raise self.ParseError(str(e)) self.NextToken() return result
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.
Ways to fix
This exception occurs when an Instance of Tokenizer is created and the _ConsumeStingleByteString function is called. When creating an instance of the Tokenizer object, you must pass in a list of Strings. These strings must each have open and closing quotation marks around them. If one of them doesn't have a closing quotation mark then this exception is thrown. It doesn't matter if you use single or double quotes to declare the value as a string as long as the opposite type is inside of it.
Code to Reproduce the Error (WRONG):
from google.protobuf.text_format import Tokenizer # Hello missing end quote tok = Tokenizer(['"Hello','"Fix"', "'Exception"]) tok._ConsumeSingleByteString()
Working Version (Fixed):
from google.protobuf.text_format import Tokenizer # Hello has both quotes tok = Tokenizer(['"Hello"','"Fix"', "'Exception"]) tok._ConsumeSingleByteString()