View Issue Details

IDProjectCategoryView StatusLast Update
0013376ScribusScripterpublic2015-11-22 13:52
ReporterjurajF Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityrandom
Status closedResolutionfixed 
PlatformqemuOSLinuxOS VersionDebian 8/Jessie
Product Version1.5.1svn 
Fixed in Version1.5.1svn 
Summary0013376: Python error cleared too early
DescriptionIn ticket 0013039 note: 0013039:0035302 eilygre mentions getting this error message:

Error retrieving error message content after script exeption!                                          
Exception was:                                                                                         
KeyError: '_errorMSG'                                                                     


This is caused by Python error being created and afterwords it is accessed by
PyErr_Print();
Additional InformationThis patch should cleanly apply to 1.4 version too.
TagsNo tags attached.
PatchYes

Relationships

related to 0013039 closedpsmedley Error at startup prevents using script 

Activities

jurajF

2015-09-27 14:36

reporter  

0001-Python-error-cleared-too-early.patch (1,444 bytes)   
From 4aaab9b8ee02fcbba96bc6572f7a91934547a2cb Mon Sep 17 00:00:00 2001
From: Juraj Fedel <wtxnh-scribus@yahoo.com.au>
Date: Sun, 27 Sep 2015 15:39:50 +0200
Subject: [PATCH] Python error cleared too early.

---
 scribus/plugins/scriptplugin/scriptercore.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scribus/plugins/scriptplugin/scriptercore.cpp b/scribus/plugins/scriptplugin/scriptercore.cpp
index 4ec6088..37b8318 100644
--- a/scribus/plugins/scriptplugin/scriptercore.cpp
+++ b/scribus/plugins/scriptplugin/scriptercore.cpp
@@ -331,8 +331,6 @@ void ScripterCore::slotRunScriptFile(QString fileName, QStringList arguments, bo
 		// other return value (most likely None anyway) and can ignore it.
 		if (result == NULL)
 		{
-			// We've already saved the exception text, so clear the exception
-			PyErr_Clear();
 			PyObject* errorMsgPyStr = PyMapping_GetItemString(globals, (char*)"_errorMsg");
 			if (errorMsgPyStr == NULL)
 			{
@@ -358,6 +356,8 @@ void ScripterCore::slotRunScriptFile(QString fileName, QStringList arguments, bo
 									+ tr("This message is in your clipboard too. Use Ctrl+V to paste it into bug tracker.")
 									+ "</p></qt>");
 			}
+			// We've already processed the exception text, so clear the exception
+			PyErr_Clear();
 		} // end if result == NULL
 		// Because 'result' may be NULL, not a PyObject*, we must call PyXDECREF not Py_DECREF
 		Py_XDECREF(result);
-- 
2.1.4

Kunda

2015-09-28 15:09

updater   ~0036425

Thanks for the submission Juraj :)

Kunda

2015-09-30 21:10

updater   ~0036460

Craig, does this need to be backported as well ?

Issue History

Date Modified Username Field Change
2015-09-27 14:36 jurajF New Issue
2015-09-27 14:36 jurajF File Added: 0001-Python-error-cleared-too-early.patch
2015-09-28 15:09 Kunda Note Added: 0036425
2015-09-28 18:20 Kunda Summary Python error cleared too early => [Patch] Python error cleared too early
2015-09-28 18:20 Kunda Description Updated
2015-09-28 18:20 Kunda Relationship added related to 0013039
2015-09-28 18:22 Kunda Description Updated
2015-09-28 20:32 cbradney Status new => resolved
2015-09-28 20:32 cbradney Fixed in Version => 1.5.1svn
2015-09-28 20:32 cbradney Resolution open => fixed
2015-09-28 20:32 cbradney Assigned To => cbradney
2015-09-30 21:10 Kunda Note Added: 0036460
2015-10-03 20:18 cbradney Status resolved => closed
2015-11-22 13:52 jghali Summary [Patch] Python error cleared too early => Python error cleared too early