From ff52803eff7fa887b65ac7ce84a89a06f16ecfcb Mon Sep 17 00:00:00 2001 From: RusAnon Date: Mon, 3 May 2010 15:00:18 +1100 Subject: [PATCH] Import from package; Check for import errors and handle them --- dfhack/python/DF_Imports.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dfhack/python/DF_Imports.cpp b/dfhack/python/DF_Imports.cpp index 6bc07e546..249b53587 100644 --- a/dfhack/python/DF_Imports.cpp +++ b/dfhack/python/DF_Imports.cpp @@ -61,7 +61,12 @@ static void DoImports() { if(FlagsModule == NULL) { - FlagsModule = PyImport_ImportModule("pydfhackflags"); + FlagsModule = PyImport_ImportModule("pydfhack.pydfhackflags"); + if (PyErr_Occurred()) + { + PyErr_Print(); + return ; + } CreatureFlags1_type = PyObject_GetAttrString(FlagsModule, "CreatureFlags1"); CreatureFlags2_type = PyObject_GetAttrString(FlagsModule, "CreatureFlags2"); @@ -72,7 +77,12 @@ static void DoImports() } if(TypesModule == NULL) { - TypesModule = PyImport_ImportModule("pydftypes"); + TypesModule = PyImport_ImportModule("pydfhack.pydftypes"); + if (PyErr_Occurred()) + { + PyErr_Print(); + return ; + } Note_type = PyObject_GetAttrString(TypesModule, "Note"); Construction_type = PyObject_GetAttrString(TypesModule, "Construction");