[Scribus] problems with scripts, and a fix

Randolph Bentson bentson
Sat May 31 03:59:29 CEST 2003


I've been bumping into a problem running scripts with recent versions of
Scribus.  When I attempt to run a script by "Script > Execute Script", I
get an error "scribus: Objects/stringobject.c:111: PyString_FromString:
Assertion `str != ((void *)0)' failed."  I worked around this by placing
desired scripts in ~/.scribus/scripter.rc and using "Script > Recent Scripts".
This holds for 0.9.8 and 0.9.10, with Qt 3.1.1.  I don't know what it does
with Qt-3.2beta as I have only just downloaded that source.

I finally spent some time poking into the scripting code.  Since I don't
have Qt documents at hand, I've been groping my way in the dark.  I was
able to find comparable code elsewhere and have developed the following
change which seems to fix the problem.

-- 
Randolph Bentson
bentson at holmsjoen.com


diff -ru scribus-scripting-0.4/scriptplugin/scriptplugin.cpp scribus-scripting-0.4_NEW/scriptplugin/scriptplugin.cpp
--- scribus-scripting-0.4/scriptplugin/scriptplugin.cpp	2003-01-31 00:04:11.000000000 -0800
+++ scribus-scripting-0.4_NEW/scriptplugin/scriptplugin.cpp	2003-05-30 17:40:45.000000000 -0700
@@ -114,9 +114,9 @@
 {
 	QString fileName;
 	CustomFDialog diaf((QWidget*)parent(), QObject::tr("Open"), QObject::tr("Python Scripts (*.py);; All Files (*)"));
-	if (diaf.exec())
+	if (diaf.exec() == QDialog::Accepted)
 		{
-		fileName = diaf.selectedFiles()[0];
+		fileName = diaf.selectedFile();
 		slotRunScriptFile(fileName);
 		rmen->clear();
 		if (RecentScripts.findIndex(fileName) == -1)



More information about the scribus mailing list