[Stackless] Sudden error with pyexpat
Santiago Gala
sgala at apache.org
Mon Feb 11 14:59:44 CET 2008
El dom, 10-02-2008 a las 22:28 +0100, Andrew Dalke escribió:
> 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)
>
>>> sys.maxunicode
1114111
for a UCS4 build. Most linuxes are currently using UCS4 builds.
WRT package manager, I can't remember the magic incantation to get what
package a file belongs to, but something like:
dpkg-query
-S /usr/lib/python2.5/site-packages/_xmlplus/parsers/pyexpat.so
should tell you if the file came from a package, and then you can use
the package manager to remove it.
Regards
Santiago
>
>
> 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
>
>
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list