Skip to content

Commit 864c8ff

Browse files
author
Roberto De Ioris
committed
added support for python home, should fix 20tab#131
1 parent 7c739ca commit 864c8ff

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ static void UESetupPythonInterpeter(bool verbose) {
8686
void FUnrealEnginePythonModule::StartupModule()
8787
{
8888
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
89+
FString PyHome;
90+
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("Home"), PyHome, GEngineIni)) {
91+
#if PY_MAJOR_VERSION >= 3
92+
wchar_t *home = (wchar_t *)*PyHome;
93+
#else
94+
char *home = TCHAR_TO_UTF8(*home);
95+
#endif
96+
97+
Py_SetPythonHome(home);
98+
}
8999

90100
Py_Initialize();
91101
#if PY_MAJOR_VERSION >= 3
@@ -234,7 +244,7 @@ void FUnrealEnginePythonModule::RunFile(char *filename) {
234244
}
235245
#endif
236246

237-
}
247+
}
238248

239249
// run a python script in a new sub interpreter (useful for unit tests)
240250
void FUnrealEnginePythonModule::RunFileSandboxed(char *filename) {

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public class UnrealEnginePython : ModuleRules
1818
{
1919
"C:/Program Files/Python36",
2020
"C:/Program Files/Python35",
21-
"C:/Python27"
21+
"C:/Python27",
22+
"C:/IntelPython35"
2223
};
2324

2425
private string[] macKnownPaths =

0 commit comments

Comments
 (0)