58 |
irc_display_prefix (NULL, PREFIX_ERROR); |
irc_display_prefix (NULL, PREFIX_ERROR); |
59 |
gui_printf (NULL, |
gui_printf (NULL, |
60 |
_("%s error: wrong parameters for \"%s\" function\n"), |
_("%s error: wrong parameters for \"%s\" function\n"), |
61 |
"Python", "print_with_channel"); |
"Python", "register"); |
62 |
return NULL; |
return NULL; |
63 |
} |
} |
64 |
|
|
140 |
irc_display_prefix (NULL, PREFIX_ERROR); |
irc_display_prefix (NULL, PREFIX_ERROR); |
141 |
gui_printf (NULL, |
gui_printf (NULL, |
142 |
_("%s error: wrong parameters for \"%s\" function\n"), |
_("%s error: wrong parameters for \"%s\" function\n"), |
143 |
"Python", "print"); |
"Python", "prnt"); |
144 |
return NULL; |
return NULL; |
145 |
} |
} |
146 |
|
|
407 |
{ |
{ |
408 |
wee_log_printf (_("Loading %s module \"weechat\"\n"), "Python"); |
wee_log_printf (_("Loading %s module \"weechat\"\n"), "Python"); |
409 |
Py_InitModule ("weechat", weechat_funcs); |
Py_InitModule ("weechat", weechat_funcs); |
410 |
|
|
411 |
|
if (PyRun_SimpleString ( |
412 |
|
"import weechat, sys, string\n" |
413 |
|
|
414 |
|
"class weechatStdout:\n" |
415 |
|
"\tdef write(self, str):\n" |
416 |
|
"\t\tstr = string.strip(str)\n" |
417 |
|
"\t\tif str != \"\":\n" |
418 |
|
"\t\t\tweechat.prnt(\"Python stdout : \" + str, \"\")\n" |
419 |
|
|
420 |
|
"class weechatStderr:\n" |
421 |
|
"\tdef write(self, str):\n" |
422 |
|
"\t\tstr = string.strip(str)\n" |
423 |
|
"\t\tif str != \"\":\n" |
424 |
|
"\t\t\tweechat.prnt(\"Python stderr : \" + str, \"\")\n" |
425 |
|
|
426 |
|
"sys.stdout = weechatStdout()\n" |
427 |
|
"sys.stderr = weechatStderr()\n" |
428 |
|
) != 0) |
429 |
|
{ |
430 |
|
irc_display_prefix (NULL, PREFIX_PLUGIN); |
431 |
|
gui_printf (NULL, |
432 |
|
_("%s error: error while redirecting stdout and stderr\n"), |
433 |
|
"Python"); |
434 |
|
} |
435 |
} |
} |
436 |
} |
} |
437 |
|
|