3 Replies Latest reply on May 10, 2019 11:02 AM by Geraldine Zanolli

    Using SDK API - TDE_RuntimeError: error converting utf32 to utf16: 10

    Ian O'Shaughnessy

      Hello,

       

      I'm getting a strange error when using tableau SDK API 2018.3 on Mac 10.14 with Python 2.7

       

      (Edit: this forum seems to also have trouble with unicode. The "polish" var is supposed to contain a Polish flag emoji, eg: "     Polish")

       

      # -*- coding: utf-8 -*-
      from tableausdk import Collation, Type
      from tableausdk.HyperExtract import ExtractAPI, Extract, TableDefinition, Row
      import os
      
      
      os.environ["TAB_SDK_LOGDIR"] = "/tmp"
      os.environ["TAB_SDK_TMPDIR"] = "/tmp"
      
      filename = "/Users/ian/Desktop/t_error.hyper"
      
      if os.path.exists(filename):
          os.unlink(filename)
      
      polish = u"     Polish"
      
      ExtractAPI.initialize()
      hyper_extract = Extract(path=filename)
      
      # Define table schema
      schema = TableDefinition()
      schema.setDefaultCollation(Collation.EN_US)
      schema.addColumn("category", Type.UNICODE_STRING)
      hyper_extract.addTable("sample", schema)
      handle = hyper_extract.openTable("sample")
      
      # Write row
      row = Row(schema)
      row.setString(0, polish)
      handle.insert(row)
      
      # Close file
      hyper_extract.close()
      
      

       

      Result:

      libc++abi.dylib: terminating with uncaught exception of type TDE_RuntimeError: error converting utf32 to utf16: 10

       

      The error seems to only happen when using 4 byte unicode sequences, 3 byte and smaller work fine.

       

      Any ideas?