Undefined symbol PyUnicodeUCS2_DecodeUTF8

Diez B. Roggisch deets at nospam.web.de
Sat Apr 4 13:10:36 CEST 2009

Manish Jain schrieb:
> Hi all,
> I am using Gnome on FreeBSD 7.1. A few days back, my gnome crashed and I 
> have had to spend over 4 days recovering my gnome environment. Pretty 
> much everything is okay now except for a few python-dependent 
> applications (alacarte, for instance), which exit immediately with the 
> following error message :
>>  Traceback (most recent call last):
>>   File "/usr/local/bin/alacarte", line 22, in <module>
>>     from Alacarte.MainWindow import MainWindow
>>   File 
>> "/usr/local/lib/python2.5/site-packages/Alacarte/MainWindow.py", line 
>> 19, in <module>
>>     import gtk, gtk.glade, gmenu, gobject, gio
>>   File 
>> "/usr/local/lib/python2.5/site-packages/gtk-2.0/gtk/__init__.py", line 
>> 38, in <module>
>>     import gobject as _gobject
>>   File 
>> "/usr/local/lib/python2.5/site-packages/gtk-2.0/gobject/__init__.py", 
>> line 33, in <module>
>>     from glib import spawn_async, idle_add, timeout_add, 
>> timeout_add_seconds, \
>>   File 
>> "/usr/local/lib/python2.5/site-packages/gtk-2.0/glib/__init__.py", 
>> line 30, in <module>
>>     from glib._glib import *
>> ImportError: 
>> /usr/local/lib/python2.5/site-packages/gtk-2.0/glib/_glib.so: 
>> Undefined symbol "PyUnicodeUCS2_DecodeUTF8"
>> [1]+  Exit 1                  alacarte
> I have searched google/yahoo for any help without luck. I have rebuilt 
> all python and gtk2 ports from scratch but the error continues.
> Can anybody please point out the source and/or remedy for the problem ? 
> I am using the python25 port.

Your problem is that your Python interpreter is not compiled with the 
same settings as the binary extensions you use. Python can use UTF16 or 
UTF32 as internal representation for unicode. AFAIK nowadays, 
distributions agreed to use the latter.

The gtk-binding of yours seems to be compiled against an interpreter 
that uses the former.

So you have to either recompile python to match the extensions 
expectations - or the other way round. I'd suggest the latter, as you 
might have a mixture of extensions which some of then won't work with 
the new interpreter.


More information about the Python-list mailing list