Jeffrey Barish wrote:
F. Oliver Gathmann wrote:
I had the same problem on SuSE 10.0. My workaround was to compile Python
with wide unicode support - i.e., passing --enable-unicode=ucs4 to the
Python configure script.
The Python on Ubuntu should already have the ucs4 unicode option turned on.
$ python2.4
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxunicode
1114111
>>>
The 111411 indicates it is using UCS4, if the value was 65535 then it would be UCS2. That's on Dapper, so unless they've changed it to UCS2 in Edgy for some reason there shouldn't be a need to rebuild anything.
I tried what you suggested. Much to my amazement, I was able to compile a
new Python with little difficulty. However, before running make install, I
figured that I should remove the Python that was already on the system. On
Ubuntu, removing Python (using apt) removes most of the OS. I spent all
day yesterday reinstalling the OS. This time I figured I better ask first. Where does make install put the new Python?
Wherever you specified with the --prefix= configure option. If you didn't specify anything then it will go to /usr/local.
If it puts the new Python
in /usr/local/bin (and does not pollute either /usr/bin or /usr/lib) then I
suppose that I could operate my system with two Pythons, but that solution
seems clumsy. Does anyone know whether there is a way to upgrade the
Python on Ubuntu to wide unicode support? Is there a wxPython package that
does not require wide unicode support? I see that there are both ansi- and
unicode-based packages for three RPM-based distributions. How about
Debian?
The UCS4/UCS2 issue is not the same. That option controls what size a character in a Python unicode object is, and also what related Python APIs are available. The wxPython ANSI/Unicode build options control whether wxString is essentially an array of char or an array of wchar_t values (where wchar_t may be two or four bytes depending on platform and compiler.)
The error you're getting is because wxPython was built with a Python (the one from the Ubuntu APT repository) that was built with the UCS4 option and so it is expecting to find the UCS4 API available when it is loaded, but your Python was built with the UCS2 option. Are you sure that your current Python is the one from the APT repository and hasn't been overwritten sometime in the past with another custom build? If so there is probably a way to force a reinstall of the repository Python without needing to uninstall it first.
If the Python in the repository has changed its build options (I guess I should just upgrade one of my machines and check...) then the correct thing to do is to rebuild wxPython. You can get the source package and use the package tools to do that build. I don't have the commands to do that handy at the moment, but it shouldn't be too hard for you to track it down.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!