[mod_python] mysqldb calls cause segfault

Nicolas Lehuen nicolas.lehuen at gmail.com
Mon Oct 10 02:28:26 EDT 2005


Are you sure mod_python is using the same Python interpreter as the one you
made the test in ?

Try running this handler :

from mod_python import apache
import sys
def handler(req):
 req.content_type = 'text/plain'
 req.write(sys.version+'\n')
 req.write(sys.exec_prefix+'\n')
return apache.OK

Regards,
Nicolas

2005/10/9, Erdi Balint <erdibalint at freemail.hu>:
>
> Thank you, Nicolas, that fixed that problem, but now I have another one,
> when importing a module from the MySQLdb module, I get the following
> exception:
>
> File "/var/www/trivia/control/trivia.py", line 5, in _connect
> db = MySQLdb.connect(user="xxx",passwd="xxx",db="xxx")
>
> File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 66,
> in Connect
> return Connection(*args, **kwargs)
>
> File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
> 117, in __init__
> from converters import conversions
>
> File "/usr/lib/python2.3/site-packages/MySQLdb/converters.py", line
> 40, in ?
> import array
>
> ImportError: /usr/lib/python2.3/lib-dynload/array.so: undefined symbol:
> PyUnicodeUCS4_FromUnicode
>
> I've come across a python faq item, that says the following about the
> cause of the error:
>
> "...
> If instead the name of the undefined symbol starts with PyUnicodeUCS4,
> the problem is the reverse: Python was built using 2-byte Unicode
> characters, and the extension module was compiled using a Python with
> 4-byte Unicode characters.
> ...
>
> You can check the size of the Unicode character a Python interpreter is
> using by checking the value of sys.maxunicode:
>
> >>> import sys
> >>> if sys.maxunicode > 65535:
> ... print 'UCS4 build'
> ... else:
> ... print 'UCS2 build'
>
> "
> Ok, so in theory, my Python interpreter uses 2-byte Unicode characters,
> but I've checked it (I am python 2.3.5) with the above code snipplet,
> and it is not so, I am using 4-byte Unicode characters? Then why is the
> error?
>
> Thank you for your help,
> Balint
>
>
> Nicolas Lehuen wrote:
> > Hi Erdi,
> >
> > Have a look at this FAQ entry, it may be related to your problem :
> >
> > http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
> > <http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp>
> >
> > Regards,
> > Nicolas
> >
> > 2005/10/9, Erdi Balint <erdibalint at freemail.hu
> > <mailto:erdibalint at freemail.hu>>:
> >
> > Hi all,
> >
> > I am trying to write a small python-mysql application with mod_python
> > but got stuck right at the beginning. The following code snippet:
> >
> > import MySQLdb
> > db = MySQLdb.connect(user="xxx",passwd="xxx",db="xxx")
> > return db
> >
> > causes a Segmentation fault.
> >
> > apache log:
> >
> > [Sun Oct 9 11:09:52 2005] [notice] child pid 6736 exit signal
> > Segmentation fault (11)
> >
> > (in fact, any mysql db operation causes the same)
> >
> > I am using python-mysqldb version 1.2.1c3-2 and libapache-mod-python
> > version 2.7.10-4 (both installed from Debian packages, thinking that
> > they were stable releases). Apache version is 1.3.33. Am I doing
> > something wrong?
> >
> > Thank you for your help,
> > Balint
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org <mailto:Mod_python at modpython.org>
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051010/91d52588/attachment.html


More information about the Mod_python mailing list