Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-14 16:53:47 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-14 16:53:47 +0400
commit8ab7fbe79563895b38bcfc50625e19fa2b38f843 (patch)
treeb161a037474a34fabcbcaa4dc80600bf28bf536d /source/blender/editors/space_script
parentc3c38155ad2aca369fa956b2251ed41c749942cc (diff)
Blender/Python API
Send the full python stack trace to the reporting api, added BPY_exception_buffer which temporarily overrides sys.stdout and sys.stderr to get the output (uses the io module in py3 StringIO in py2 to avoid writing into a real file), pity the Py/C api has no function to do this. fix for crash when showing menu's that have no items.
Diffstat (limited to 'source/blender/editors/space_script')
-rw-r--r--source/blender/editors/space_script/script_edit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 797302a8652..88b8dccc6c9 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -62,15 +62,17 @@
static int run_pyfile_exec(bContext *C, wmOperator *op)
{
ARegion *ar= CTX_wm_region(C);
+
char filename[512];
RNA_string_get(op->ptr, "filename", filename);
#ifndef DISABLE_PYTHON
- BPY_run_python_script(C, filename, NULL);
+ if(BPY_run_python_script(C, filename, NULL, op->reports)) {
+ ED_region_tag_redraw(ar);
+ return OPERATOR_FINISHED;
+ }
#endif
- ED_region_tag_redraw(ar);
-
- return OPERATOR_FINISHED;
+ return OPERATOR_CANCELLED; /* FAIL */
}
void SCRIPT_OT_python_file_run(wmOperatorType *ot)