Your message dated Wed, 04 Nov 2015 20:57:51 +1100
with message-id <[email protected]>
and subject line Re: Bug#526513: ImportError when using MySQLdb in embedded
python
has caused the Debian Bug report #526513,
regarding ImportError when using MySQLdb in embedded python
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
526513: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526513
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-mysqldb
Version: 1.2.2-7
On Debian GNU/Linux 5.0 (lenny). Python 2.5.2-3.
When python is embedded in a shared library (in my case a plugin), the
_mysql.so component of MySQLdb fails to load, due to this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: /var/lib/python-support/python2.5/_mysql.so: undefined
symbol: PyExc_ImportError
Discovered while trying to use the ida2sql.py script within IDAPython.
A simple example program is attached demonstrating the problem clearly,
this sample program also demonstrates a work-around, by setting the
RTLD_GLOBAL flag when loading the shared library, the necessary python
symbols are exported for _mysql.so and it loads correctly. Unfortunately
this isn't possible in my situation since IDA Pro is not open source,
and in general I think it's unwise for an application to export all the
symbols from any plugins it may load as there is a high probability of a
symbol collision.
I have also been able to work around this issue by re-linking _mysql.so
and including a direct dependancy on libpython2.5.so.1.0. This may not
be the right thing to do when using MySQLdb from the standard python
interpreter however?
#include <stdio.h>
#include <dlfcn.h>
int main(int argc) {
int flags = (argc > 1) ? RTLD_LAZY | RTLD_GLOBAL : RTLD_LAZY;
void *h = dlopen("./pysql.so", flags);
if (h) {
void *s = dlsym(h, "pysql");
if (s) {
((void (*)())s)();
} else {
fprintf(stderr, "Unresolved: pysql\n");
}
} else {
perror("loading pysql.so");
}
return 0;
}
#include <Python.h>
void pysql() {
Py_Initialize();
PyRun_SimpleString("import _mysql\nprint 'Got here'");
Py_Finalize();
}
pymain: pymain.c pysql.so
gcc -o pymain pymain.c -ldl
pysql.so: pysql.c
gcc -shared -o pysql.so -I/usr/include/python2.5 pysql.c -lpython2.5
--- End Message ---
--- Begin Message ---
Brian May <[email protected]> writes:
> Is this still a problem with the latest python-mysqldb version 1.3.6-1
> in unstable?
The email to the submitter bounced:
<[email protected]>: host smtpe1.intersmtp.com[62.239.224.237] said: 550 5.1.1
User unknown (in reply to RCPT TO command)
I am going to close this bug report.
--
Brian May <[email protected]>
--- End Message ---
_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team