summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorEmmanuel Bouthenot <kolter@openics.org>2005-11-22 20:47:53 +0000
committerEmmanuel Bouthenot <kolter@openics.org>2005-11-22 20:47:53 +0000
commit163ded5658ab4ddae6d82c5b842a2b65d593d024 (patch)
treec178de75cd0ef77b08b725a7802477375b6cb87e /src/plugins
parent80ed16c3c01a4edb68816150b9b73ff72f52389c (diff)
downloadweechat-163ded5658ab4ddae6d82c5b842a2b65d593d024.zip
display python trackback on errors
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/scripts/python/weechat-python.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 4fca21184..c75982796 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -68,19 +68,22 @@ weechat_python_exec (t_weechat_plugin *plugin,
function);
return PLUGIN_RC_KO;
}
-
+
ret = -1;
python_current_script = script;
rc = PyObject_CallFunction(evFunc, "ss", server == NULL ? "" : server, arguments == NULL ? "" : arguments);
-
+
if (rc)
{
ret = (int) PyInt_AsLong(rc);
Py_XDECREF(rc);
}
-
+
+ if (PyErr_Occurred ())
+ PyErr_Print ();
+
if (ret < 0)
return PLUGIN_RC_OK;
else
@@ -757,6 +760,9 @@ weechat_python_output (PyObject *self, PyObject *args)
return NULL;
}
+ while (strlen(msg) > 0 && msg[strlen(msg)-1] == '\n')
+ msg[strlen(msg)-1] = '\0';
+
python_plugin->printf_server (python_plugin,
"Python stdin/stdout: %s", msg);
return Py_BuildValue ("i", 1);
@@ -859,7 +865,10 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
weechat_script_remove (plugin, &python_scripts, python_current_script);
return 0;
}
-
+
+ if (PyErr_Occurred ())
+ PyErr_Print ();
+
fclose (fp);
free (python_current_script_filename);