File->Call Script works only first time
Michal Nowakowski <[email protected]> Sat, 23 May 2015 18:00:42 +0200
| Newsgroups | gmane.comp.fonts.fontforge.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
my scripts from Call Script menu only work first time I use any.
Subsequent attempts end up with message:
File "script.py", line 2, in <module>
import fontforge
SystemError: _PyImport_FixupExtension: module fontforge not loaded
I need to restart FontForge to avoid it.
Look like it stores references from Py_InitModule3() for reuse.
But they are "borrowed references", and in my setup (Ubuntu 14.04,
Python 2.7.6) python forgets them after Py_Finalize().
Patch attached. It helps me, but needs to be checked first.
--
Regards,
MichaĆ Nowakowski
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html
python.c.patch
(text/x-patch, 519 B)
diff --git a/fontforge/python.c b/fontforge/python.c
index 68b314d..70cc964 100644
--- a/fontforge/python.c
+++ b/fontforge/python.c
@@ -18158,7 +18158,8 @@ static PyObject* CreatePyModule( module_definition *mdef ) {
PyObject *module;
if ( mdef->runtime.module != NULL )
- return mdef->runtime.module;
+ if ( mdef->runtime.module == PyImport_AddModule(mdef->module_name) )
+ return mdef->runtime.module;
if ( mdef->types != NULL && FinalizePythonTypes( mdef->types ) < 0 )
return NULL;