git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8340 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2008-04-12 20:53:26 +00:00
parent af391215b8
commit db9872328f

View File

@ -346,11 +346,26 @@ bool QgsPythonUtils::loadPlugin(QString packageName)
" reload(" + packageName + ")\n"
" __main__.__plugin_result = 'OK'\n"
"except:\n"
" qgis_except_hook_msg(sys.exc_type, sys.exc_value, sys.exc_traceback, "
" 'Couldn\\'t load plugin \"" + packageName + "\"')\n"
" __main__.__plugin_result = 'ERROR'\n");
return (getVariableFromMain("__plugin_result") == "OK");
if( getVariableFromMain("__plugin_result") == "OK" )
return true;
// snake in the grass, we know it's there
runString("sys.path_importer_cache.clear()");
// retry
runString(
"try:\n"
" import " + packageName + "\n"
" reload(" + packageName + ")\n"
" __main__.__plugin_result = 'OK'\n"
"except:\n"
" qgis_except_hook_msg(sys.exc_type, sys.exc_value, sys.exc_traceback, "
"'Couldn\\'t load plugin \"" + packageName + "\" from [\\'' + '\\', \\''.join(sys.path) + '\\']')\n"
" __main__.__plugin_result = 'ERROR'\n");
return getVariableFromMain("__plugin_result") == "OK";
}