"Unable to translate bytes [E9] at index 1 from specified code page to Unicode." error when executing IronPython Script in Spotfire client

"Unable to translate bytes [E9] at index 1 from specified code page to Unicode." error when executing IronPython Script in Spotfire client

book

Article ID: KB0070586

calendar_today

Updated On:

Products

Spotfire Analyst

Description

If the str() method is used in an Iron Python script to convert various types (unknown at runtime) to strings, it is likely that for some non-ASCII string values the conversion may fail with an error message similar to "Unable to translate bytes [E9] at index 1 from specified code page to Unicode."


 

Issue/Introduction

Error "Unable to translate bytes [E9] at index 1 from specified code page to Unicode." when executing IronPython script in Spotfire client

Resolution

It appears that using str() on a non-ASCII string throws the Exception: Unable to translate bytes from specified code page to Unicode.

Using the following line of code may throw the error: 

Document.Properties["CurrentMonth"]=str('Décembre')

However removing 'str()' prevents the error:

Document.Properties["CurrentMonth"]='Décembre'

Not using str() on non-ASCII characters may be a workaround for this problem.

Additional Information