[Samba] Python UCS2 vs UCS4 issue on latest git: ImportError: ....undefined symbol: PyUnicodeUCS2_Decode [SOLVED]

Phil Quesinberry philq at qsystemsengineering.com
Wed Apr 3 23:48:21 MDT 2013

I'm getting the following error attempting to run samba-tool after
installing the latest git using the install_with_python script to use Python

[root at Server1 dcerpc]# samba-tool

Traceback (most recent call last):

  File "/usr/local/samba/bin/samba-tool", line 33, in <module>

    from samba.netcmd.main import cmd_sambatool

line 20, in <module>

    from samba import getopt as options

  File "/usr/local/samba/lib/python2.6/site-packages/samba/getopt.py", line
30, in <module>

    from samba.hostconfig import Hostconfig

  File "/usr/local/samba/lib/python2.6/site-packages/samba/hostconfig.py",
line 20, in <module>

    from samdb import SamDB

  File "/usr/local/samba/lib/python2.6/site-packages/samba/samdb.py", line
32, in <module>

    from samba.dcerpc import drsblobs, misc

undefined symbol: PyUnicodeUCS2_Decode


Samba-tool was working with the previous git, so I'm not certain if this is
a problem with the latest build or a problem with Python in my environment.
If I understand this correctly, Samba was compiled with a Python version
using 2-byte Unicode characters but my Python version is using 4-byte
Unicode characters.  If that is indeed the case, why was it changed and what
would be the best way to go about fixing this problem?  I tried adding
-enable-unicode=ucs2 to the configure options in the 'install_with_python'
script but that had no effect so now I wonder if somehow a different version
of Python on the system is being referenced instead of the one included with


Any suggestions here would be greatly appreciated, even if it's only to tell
me whether or not I'm on the right track.  Thanks!


Version is 4.0.5-GIT-20b0adc.  CentOS 5.9.




Phil Quesinberry

Q Systems Engineering, Inc.

Electronic Controls and Embedded Systems Development

(410) 969-8002



More information about the samba mailing list