aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/pybase.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2006-03-23 01:55:14 +0000
committerThomas Grill <xovo@users.sourceforge.net>2006-03-23 01:55:14 +0000
commite3426779df0301ece91b851bba58704e52be2176 (patch)
tree4b86993d1edbe5d46b89382cef96814c20b4e5fb /externals/grill/py/source/pybase.cpp
parent22eaba4518f85902489a35dbac0fd97654b59d43 (diff)
corrected Python object propagation (attribute "py") and adjusted help files
small fix enable module packages (module/__init__.py[co]), now also for Max enable compiled-only scripts (without .py) svn path=/trunk/; revision=4751
Diffstat (limited to 'externals/grill/py/source/pybase.cpp')
-rw-r--r--externals/grill/py/source/pybase.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/externals/grill/py/source/pybase.cpp b/externals/grill/py/source/pybase.cpp
index f4762fbf..c0f2bc44 100644
--- a/externals/grill/py/source/pybase.cpp
+++ b/externals/grill/py/source/pybase.cpp
@@ -454,6 +454,7 @@ static bool getmodulesub(const char *mod,char *dir,int len,char *ext)
// if dir is current working directory... name points to dir
if(dir == name) strcpy(dir,".");
+ return name != NULL;
#elif FLEXT_SYS == FLEXT_SYS_MAX
short path;
long type;
@@ -570,16 +571,15 @@ bool pybase::ReloadModule()
if(module)
newmod = PyImport_ReloadModule(module);
else {
- // search in module path
+ // search in module path (TODO: check before if module is already present to avoid costly searching)
char dir[1024];
- if(getmodulepath(modname.c_str(),dir,sizeof(dir))) {
- AddToPath(dir);
- newmod = PyImport_ImportModule((char *)modname.c_str());
- }
- else {
+ if(!getmodulepath(modname.c_str(),dir,sizeof(dir)))
PyErr_SetString(PyExc_ImportError,"Module not found in path");
- newmod = NULL;
- }
+ else
+ AddToPath(dir);
+
+ // module could also be loaded ok, even if it's not in the path (e.g. for internal stuff)
+ newmod = PyImport_ImportModule((char *)modname.c_str());
}
}
else {