{"record":{"id":"bb4940c46a2e680d","repo":"tensorflow/models","slug":"unsupported-string-type-s","errorCode":null,"errorMessage":"Unsupported string type: %s","messagePattern":"Unsupported string type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/xlnet/preprocess_utils.py","lineNumber":35,"sourceCode":"import unicodedata\n\nimport six\n\nSPIECE_UNDERLINE = '▁'\n\n\ndef printable_text(text):\n  \"\"\"Returns text encoded in a way suitable for print or `tf.logging`.\"\"\"\n\n  # These functions want `str` for both Python2 and Python3, but in one case\n  # it's a Unicode string and in the other it's a byte string.\n  if six.PY3:\n    if isinstance(text, str):\n      return text\n    elif isinstance(text, bytes):\n      return text.decode('utf-8', 'ignore')\n    else:\n      raise ValueError('Unsupported string type: %s' % (type(text)))\n  elif six.PY2:\n    if isinstance(text, str):\n      return text\n    elif isinstance(text, unicode):  # pylint: disable=undefined-variable\n      return text.encode('utf-8')\n    else:\n      raise ValueError('Unsupported string type: %s' % (type(text)))\n  else:\n    raise ValueError('Not running on Python2 or Python 3?')\n\n\ndef print_(*args):\n  new_args = []\n  for arg in args:\n    if isinstance(arg, list):\n      s = [printable_text(i) for i in arg]\n      s = ' '.join(s)\n      new_args.append(s)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/xlnet/preprocess_utils.py#L17-L53","documentation":"Error \"Unsupported string type: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/xlnet/preprocess_utils.py:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}