[Stackless] Sudden error with pyexpat

Andrew Dalke dalke at dalkescientific.com
Sun Feb 10 22:28:57 CET 2008


On Feb 10, 2008, at 10:47 AM, Simon Pickles wrote:
> I've been using ElementTree for a few weeks without problem, with
> Stackless Python.
>
> Suddenly I have an error importing expat, in both application and  
> console:


>     from pyexpat import *
> ImportError:
> /usr/lib/python2.5/site-packages/_xmlplus/parsers/pyexpat.so:  
> undefined
> symbol: PyUnicodeUCS4_Decode
>>>>
>
> On the python mailing list, I got this response:
>
> "You changed the build-time configuration of your Python  
> installation, so you
> should rebuild PyXML for the new interpreter (or uninstall it, as  
> you don't
> need it for ElementTree)."
>
> Does this mean Stackless is confusing the pyexpat.so library? Why  
> would it work last week?


Python supports two different internal representation for Unicode -  
UCS2 and US4.  These are 16-bit and 32-bit internal representations.

The choice is a compile time option, and it depends on the vendor,  
and sometimes you can select one version or the other.

Ubuntu I believe ships as UCS-4.

What did you compile Stackless Python as?  It's a compile-time option.

To find out, look at sys.maxunicode.  My machine is compile for UCS-2 so

 >>> sys.maxunicode
65535

That should be a lot larger for UCS-4.  Or do

 >>> unichr(0x10000)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: unichr() arg not in range(0x10000) (narrow Python build)



This error message looks like you installed the third-party "PyXML"  
package for Python.  That's what uses the "_xmlplus" directory.  When  
did you install that package?  Why?  It's unmaintained.  Python's  
standard distribution include an expat parser, so you don't need that  
extension.

    http://docs.python.org/lib/module-xml.parsers.expat.html


I can't help with Ubuntu.  I get confused by package managers.


				Andrew
				dalke at dalkescientific.com






More information about the Stackless mailing list