Known Issue: Executing Python scripts that change locale will result in unexpected errors in FME 2022.0

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0
Known Issue ID FMEENGINE-72009
Discovered 2022.0
Affects 2022.0 and newer
Resolved N/A

Symptom

When executing Python scripts in FME 2022.0 and newer that change the system locale, such as import arcpy or locale.setlocale(), unexpected errors may occur due to a conflict with FME using UTF-8. For more information on UTF-8 in FME 2022, please see this article. It is advised to avoid changing the locale if at all possible
 

Cause

With FME 2022.0 and newer, FME will process all workspaces using UTF-8 as the encoding for most string data when running on Windows 10+ or Windows Server 2019+, this allows for FME to execute workspaces that are created in different locales and will help minimize locale issues. 

When running a Python script that changes the locale, this will conflict with FME’s ability to use UTF-8, and will put the FME process in a bad state, which may result in unexpected errors in the translation. For more information on changing the locale in Python, please see this article
 

Workaround

If you need to set a locale for a particular script or are using a script that changes the locale (import arcpy), you can set the locale back to UTF within the same PythonCaller to ensure FME continues using UTF-8. 

Example: 

import arcpy
import locale
locale.setlocale(locale.LC_ALL, ".utf8")

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.