diff options
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonController.cpp | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 3ffba14ec95..93183dafeee 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -49,4 +49,3 @@ ELSE(WITH_PYTHON) ENDIF(WITH_PYTHON) BLENDERLIB(bf_logic "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_logic', sources, Split(incs), [], libtype=['game','player'], priority=[30, 110] ) diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index bcc61b533c3..48fdcb3eb44 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -305,7 +305,7 @@ bool SCA_PythonController::Import() char *function_string; function_string= strrchr(mod_path, '.'); - + if(function_string == NULL) { printf("Python module name formatting error \"%s\":\n\texpected \"SomeModule.Func\", got \"%s\"\n", GetName().Ptr(), m_scriptText.Ptr()); return false; @@ -316,11 +316,17 @@ bool SCA_PythonController::Import() // Import the module and print an error if it's not found PyObject *mod = PyImport_ImportModule(mod_path); - if(mod && m_debug) + + if (mod == NULL) { + ErrorPrint("Python module can't be imported"); + return false; + } + + if(m_debug) mod = PyImport_ReloadModule(mod); if (mod == NULL) { - ErrorPrint("Python module not found"); + ErrorPrint("Python module can't be reloaded"); return false; } |