Thought I'd reply to myself. Better late than never.
The answer is yes, there is a simple way to get psycopg to work with
python built with ucs2.
If you're seeing the following error:
undefined symbol: PyUnicodeUCS4_Decode
You have two choices:
1. recompile python with ucs4 OR,
2. recompile psycopg2 with a python that was built with ucs2
As far as I can tell, psycopg2 makes no assumption on the unicode
width - it will work with whatever python it's compiled with.
For 1., pass '--enable-unicode=ucs4' to python's configure script and
For 2., run the setup.py script with a ucs2 python (i.e.
`python-built-with-ucs2 setup.py build`)
pythons unicode C api was designed as follows (from unicodeobject.h):
/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */
/* Unicode API names are mangled to assure that UCS-2 and UCS-4 builds
produce different external names and thus cause import errors in
case Python interpreters and extensions with mixed compiled in
Unicode width assumptions are combined. */
# define PyUnicode_Decode PyUnicodeUCS2_Decode
# define PyUnicode_Decode PyUnicodeUCS4_Decode
On Fri, Jul 29, 2011 at 10:01 AM, Scott Rohde <srohde(at)gmail(dot)com> wrote:
> When I import psycopg2 from python built with ucs2 I get the following error:
> ImportError: /usr/local/lib/python2.4/site-packages/psycopg2/_psycopg.so:
> undefined symbol: PyUnicodeUCS4_Decode
> By recompiling python to use ucs4 this error goes away and I can
> successfully use psycopg2.
> However, in my situation it would be much more convenient if I could
> get psycopg2 to work with python built with ucs2. Is there a simple
> way to do that?
> Thanks very much,
In response to
psycopg by date
|Next:||From: Federico Di Gregorio||Date: 2011-09-07 09:12:13|
|Subject: Re: About pyvertica (a clone of pyscopg2)|
|Previous:||From: Daniele Varrazzo||Date: 2011-09-02 15:00:16|
|Subject: Re: psycopg2.extensions.adap|