I Thought i would see if anyone on this list can help, i am no expert in c or the build systems that are often used, however i managed to create a small plugin in python which geany can run however i can not use gtk.
I have reduced the plugin down to its bare minimum it simple loads the the python interpreter and imports gtk library.
If i do this outside the embeded python it imports and i can use the gtk library, so why does it not work when embeded i am on ubuntu 10.10 64bit if its a specific issue on this platform.
the code is below or you can get the code with the build system from the link below, obviously to see the error you need to load the plugin into geany.
I am guessing this is a linking issue just hoping someone can point me in the right
#include <Python.h> /* For Python itself. This MUST come first. */ #include "geany.h" /* for the GeanyApp data type */ #include "geanyplugin.h" /* for the GeanyApp data type */ #include "plugindata.h" /* this defines the plugin API */
#define PLUGIN_NAME _("Geany Python Test")
PLUGIN_VERSION_CHECK(GEANY_API_VERSION)
/* All plugins must set name, description, version and author. */ PLUGIN_SET_INFO(PLUGIN_NAME, _("Test Python plugin."), _(VERSION), _("Test Author"))
/* initialise the plugin */ void plugin_init(GeanyData *data){ printf("Loading the test Python module.\n"); Py_Initialize(); /* Start the Python interpreter. */ PyRun_SimpleString("import gtk"); }
/* Cleanup the plugin when required */ void plugin_cleanup(void){ Py_Finalize(); }
This is the error i get when launching the plugin in geany
Loading the test Python module. Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py", line 30, in <module> import gobject as _gobject File "/usr/lib/pymodules/python2.6/gtk-2.0/gobject/__init__.py", line 26, in <module> from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \ File "/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.py", line 22, in <module> from glib._glib import * ImportError: /usr/lib/libpyglib-2.0-python2.6.so.0: undefined symbol: PyExc_ImportError
Any one able to help, me or suggest some things i can try ??
On 11/10/2010 02:44 PM, Oliver Marks wrote:
This is the error i get when launching the plugin in geany
Loading the test Python module. Traceback (most recent call last): File "<string>", line 1, in<module> File "/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py", line 30, in<module> import gobject as _gobject File "/usr/lib/pymodules/python2.6/gtk-2.0/gobject/__init__.py", line 26, in<module> from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \ File "/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.py", line 22, in<module> from glib._glib import * ImportError: /usr/lib/libpyglib-2.0-python2.6.so.0: undefined symbol: PyExc_ImportError
Any one able to help, me or suggest some things i can try ??
I'd say it's a dynamic linking problem. After a little digging in Google (by the way, most search results are related to your(?) unanswered question on stackoverflow. meh...) I've found a few things which may be related:
* http://mail.python.org/pipermail/cplusplus-sig/2005-February/008216.html * http://mail.gnome.org/archives/desktop-devel-list/2006-February/msg00192.htm... * http://mail.python.org/pipermail/python-dev/2002-May/023923.html
The first link provides a good suggestion that should catch undefined symbols at link-time. Although you'll be using -lpython2.6 these days!
The second and third links refer to dlopen() and the RTLD_GLOBAL flag, which Py_Initialize() should be taking care of. Not sure about the state of this,; both list threads are old.
But, I'm no Python expert; just trying to help out!
thanks for the suggestions i will give them a try later but i believe i came across both post previously i dont think i tried the dll one, mainly because i thought it was windows specific, but i will also try those linker options again, i have actually done quite a lot of googling and tryed loads of linker options but there are so many options i could have got it wrong :)
I think the biggest thing the confuses is me is why running import fails only when you embed, i would have expected it to be useing the same files as the normal interpreter and just work.
On Wed, 2010-11-10 at 15:49 -0700, Jason Oster wrote:
On 11/10/2010 02:44 PM, Oliver Marks wrote:
This is the error i get when launching th plugin in geany
Loading the test Python module. Traceback (most recent call last): File "<string>", line 1, in<module> File "/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py", line 30, in<module> import gobject as _gobject File "/usr/lib/pymodules/python2.6/gtk-2.0/gobject/__init__.py", line 26, in<module> from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \ File "/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.py", line 22, in<module> from glib._glib import * ImportError: /usr/lib/libpyglib-2.0-python2.6.so.0: undefined symbol: PyExc_ImportError
Any one able to help, me or suggest some things i can try ??
I'd say it's a dynamic linking problem. After a little digging in Google (by the way, most search results are related to your(?) unanswered question on stackoverflow. meh...) I've found a few things which may be related:
http://mail.gnome.org/archives/desktop-devel-list/2006-February/msg00192.htm...
The first link provides a good suggestion that should catch undefined symbols at link-time. Although you'll be using -lpython2.6 these days!
The second and third links refer to dlopen() and the RTLD_GLOBAL flag, which Py_Initialize() should be taking care of. Not sure about the state of this,; both list threads are old.
But, I'm no Python expert; just trying to help out! _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On 11 November 2010 17:38, Oliver Marks oly@digitaloctave.com wrote:
thanks for the suggestions i will give them a try later but i believe i came across both post previously i dont think i tried the dll one, mainly because i thought it was windows specific, but i will also try those linker options again, i have actually done quite a lot of googling and tryed loads of linker options but there are so many options i could have got it wrong :)
I think the biggest thing the confuses is me is why running import fails only when you embed, i would have expected it to be useing the same files as the normal interpreter and just work.
Yes, but you are invoking the interpreter differently, its loaded from a dynamically loaded library and the environment is probably different.
Try writing a simple main program that calls the plugin function. Does that work?
If so try writing one that dynamically loads the plugin functions using glibs g_module_open then call it.
See where it fails.
Cheers Lex
PS for some reason your posts are not threading so I've lost you original code
On Wed, 2010-11-10 at 15:49 -0700, Jason Oster wrote:
On 11/10/2010 02:44 PM, Oliver Marks wrote:
This is the error i get when launching th plugin in geany
Loading the test Python module. Traceback (most recent call last): File "<string>", line 1, in<module> File "/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py", line 30, in<module> import gobject as _gobject File "/usr/lib/pymodules/python2.6/gtk-2.0/gobject/__init__.py", line 26, in<module> from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \ File "/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.py", line 22, in<module> from glib._glib import * ImportError: /usr/lib/libpyglib-2.0-python2.6.so.0: undefined symbol: PyExc_ImportError
Any one able to help, me or suggest some things i can try ??
I'd say it's a dynamic linking problem. After a little digging in Google (by the way, most search results are related to your(?) unanswered question on stackoverflow. meh...) I've found a few things which may be related:
http://mail.gnome.org/archives/desktop-devel-list/2006-February/msg00192.htm...
The first link provides a good suggestion that should catch undefined symbols at link-time. Although you'll be using -lpython2.6 these days!
The second and third links refer to dlopen() and the RTLD_GLOBAL flag, which Py_Initialize() should be taking care of. Not sure about the state of this,; both list threads are old.
But, I'm no Python expert; just trying to help out! _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On Thu, 11 Nov 2010 18:16:38 +1100 Lex Trotman elextr@gmail.com wrote:
PS for some reason your posts are not threading so I've lost you original code
Looks fine to me in Sylpheed ;-)
Nick
Le 11/11/2010 16:20, Nick Treleaven a écrit :
On Thu, 11 Nov 2010 18:16:38 +1100 Lex Trotman elextr@gmail.com wrote:
PS for some reason your posts are not threading so I've lost you original code
Looks fine to me in Sylpheed ;-)
Same here, Icedove :)