Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.42
diff -u -r1.42 scriptplugin.cpp
--- scriptplugin.cpp	14 Nov 2004 15:56:18 -0000	1.42
+++ scriptplugin.cpp	16 Nov 2004 10:02:44 -0000
@@ -242,10 +242,18 @@
 	{
 		PyObject* globals = PyModule_GetDict(m);
 		// Build the Python code to run the script
-		QString cm = QString("import sys,StringIO,traceback\n");
+		QString cm = QString("import sys\n");
+		cm        += QString("import traceback\n");
+		cm        += QString("import StringIO\n");
+		cm        += QString("import warnings\n");
+		// Put the dir containing the script into the module search path
 		cm        += QString("sys.path[0] = \"%1\"\n").arg(fi.dirPath(true));
 		cm        += QString("try:\n");
+		// This next line is a hack for some weird issues in warnings.py, see bug 1287 and warnings.py line 46-53.
+		cm        += QString("    __file__ = '%1'\n").arg(fileName);
+		// Run the darn thing:
 		cm        += QString("    execfile(\"%1\")\n").arg(fileName);
+		// Prevent it from terminating Scribus when it exits
 		cm        += QString("except SystemExit:\n");
 		cm        += QString("    pass\n");
 		// Capture the text of any other exception that's raised by the interpreter
@@ -456,7 +464,7 @@
 // is provided to direct the user to the correct function.
 // By default the warning gets output only on the first use of the function in a given
 // interpreter instance, but user scripts can change this.
-void deprecatedFunctionAlias(PyObject* scribusdict, char* oldName, char* newName)
+void deprecatedFunctionAlias(PyObject* scribusdict, const char* oldName, const char* newName)
 {
 	// Build the Python code to create the wrapper function
 	QString wrapperFunc = "";
