20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.76k stars 752 forks source link

LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 924, but it was 181. #734

Open edowson opened 5 years ago

edowson commented 5 years ago

I get a series of LogAutomationTest errors while building the UnrealEnginePython plugin for UE4.22.2 and UE4.22.3.

It appears when loading a default cpp project with the plugin installed.

It fails with an error when trying to build the derived data cache from the command line.

$UE4_DIR/Engine/Binaries/Linux/UE4Editor "$UE4_PROJECT_DIR/$UE4_PROJECT.uproject" -run=DerivedDataCache -fill -DDC=CreatePak

I have set the locale as follows in my ~/.bashrc

# Set locate
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Here is a snippet of the errors. Is there any way to resolve this?

1001[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'C locale not used' to be true.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'C locale not used' to be true.
[2019.06.06-15.52.44:161][  0]LogInit: Display: 
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 924, but it was 181.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 224, but it was 192.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 224, but it was 192.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 225, but it was 193.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 225, but it was 193.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 226, but it was 194.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 226, but it was 194.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 227, but it was 195.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 227, but it was 195.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 228, but it was 196.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 228, but it was 196.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 229, but it was 197.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 229, but it was 197.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 230, but it was 198.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 230, but it was 198.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 231, but it was 199.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 231, but it was 199.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 232, but it was 200.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 232, but it was 200.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 233, but it was 201.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 233, but it was 201.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 234, but it was 202.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 234, but it was 202.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 235, but it was 203.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 235, but it was 203.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 236, but it was 204.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 236, but it was 204.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 237, but it was 205.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 237, but it was 205.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 238, but it was 206.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 238, but it was 206.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 239, but it was 207.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 239, but it was 207.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 240, but it was 208.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 240, but it was 208.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 241, but it was 209.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 241, but it was 209.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 242, but it was 210.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 242, but it was 210.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 243, but it was 211.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 243, but it was 211.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 244, but it was 212.
[2019.06.06-15.52.44:161][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 244, but it was 212.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 245, but it was 213.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 245, but it was 213.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 246, but it was 214.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 246, but it was 214.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 248, but it was 216.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 248, but it was 216.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 249, but it was 217.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 249, but it was 217.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 250, but it was 218.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 250, but it was 218.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 251, but it was 219.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 251, but it was 219.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 252, but it was 220.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 252, but it was 220.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 253, but it was 221.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 253, but it was 221.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 254, but it was 222.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToLower()' to be 254, but it was 222.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 192, but it was 224.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 192, but it was 224.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 193, but it was 225.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 193, but it was 225.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 194, but it was 226.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 194, but it was 226.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 195, but it was 227.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 195, but it was 227.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 196, but it was 228.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 196, but it was 228.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 197, but it was 229.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 197, but it was 229.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 198, but it was 230.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 198, but it was 230.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 199, but it was 231.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 199, but it was 231.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 200, but it was 232.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 200, but it was 232.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 201, but it was 233.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 201, but it was 233.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 202, but it was 234.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 202, but it was 234.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 203, but it was 235.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 203, but it was 235.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 204, but it was 236.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 204, but it was 236.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 205, but it was 237.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 205, but it was 237.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 206, but it was 238.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 206, but it was 238.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 207, but it was 239.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 207, but it was 239.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 208, but it was 240.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 208, but it was 240.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 209, but it was 241.
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogAutomationTest: Error: Expected 'TChar::ToUpper()' to be 209, but it was 241.
1111[2019.06.06-15.52.44:162][  0]LogInit: Display: NOTE: Only first 50 errors displayed.
[2019.06.06-15.52.44:162][  0]LogInit: Display: NOTE: Only first 50 errors displayed.
1101[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: UnrealEnginePython
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: UnrealEnginePython
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonAutomation
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonAutomation
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonConsole
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonConsole
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonEditor
[2019.06.06-15.52.44:162][  0]LogInit: Display: LogInit: Warning: Incompatible or missing module: PythonEditor

1001[2019.06.06-15.52.44:162][  0]LogInit: Display: Failure - 2188 error(s), 9 warning(s)
[2019.06.06-15.52.44:162][  0]LogInit: Display: Failure - 2188 error(s), 9 warning(s)
[2019.06.06-15.52.44:162][  0]LogInit: Display: 
Execution of commandlet took:  53.39 seconds
[2019.06.06-15.52.44:162][  0]LogInit: Display: 
Execution of commandlet took:  53.39 seconds
[2019.06.06-15.52.44:163][  0]LogInit: Display: Closing DDC Pak File.
[2019.06.06-15.52.44:227][  0]LogShaderCompilers: Display: Shaders left to compile 0
Exiting abnormally (error code: 1)
ryong42 commented 5 years ago

I had a same issue on mac. How to solve this problem is to set an option in terminal. Uncheck "Set locale variables automatically".

acprog commented 3 years ago

this fixed it for me:

--- W:\UnrealProjects\pytest_422\bk\99\UnrealEnginePython\Source\UnrealEnginePython\Private\UnrealEnginePython.cpp
+++ W:\UnrealProjects\pytest_422\Plugins\UnrealEnginePython\Source\UnrealEnginePython\Private\UnrealEnginePython.cpp
@@ -47,6 +47,7 @@
 #include "Android/AndroidApplication.h"
 #endif

+#include <locale.h>

 const char *UEPyUnicode_AsUTF8(PyObject *py_str)
 {
@@ -532,6 +533,10 @@

    // release the GIL
    PyThreadState *UEPyGlobalState = PyEval_SaveThread();
+
+  setlocale(LC_ALL, "C");    
+  const char* CurrentLocale = setlocale(LC_CTYPE, nullptr);
+  UE_LOG(LogPython, Log, TEXT("now locale [%s]"), CurrentLocale);
 }

 void FUnrealEnginePythonModule::ShutdownModule()