swapnillipare / google-apps-for-your-domain-ldap-sync

Automatically exported from code.google.com/p/google-apps-for-your-domain-ldap-sync
0 stars 0 forks source link

UnicodeEncodeError: 'ascii' codec can't encode character #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Having a user with nonascii characters in lastName.

2. Command: syncOneUser uid=usuario

3.

What is the expected output? What do you see instead?

It was spected:

The user record for uid=ilegon,ou=people,dc=desic-sl,dc=com is now:
Now looking up 'ilegon' in Google Apps for Your Domain...
Google Apps for Your Domain returned the following data:
userName                      : usuario
firstName                     : Manuel
lastName                      : Legón
accountStatus                 : unlocked
emailLists                    : 
aliases                       :
Google Apps for Your Domain matches your database, and
your database matches LDAP. No action needed.

I see this, instead:

Command: syncOneUser uid=usuario
The user record for uid=usuario,ou=people,dc=xxxx,dc=xxx is now:
Now looking up 'ilegon' in Google Apps for Your Domain...
Google Apps for Your Domain returned the following data:
userName                      : usuario
firstName                     : Manuel
Traceback (most recent call last):
  File "sync_ldap.py", line 178, in ?
    (config, ldap_context, user_database, google_context, log_config) = \
  File "sync_ldap.py", line 107, in DoMain
    cmd.cmdloop()
  File "/usr/lib/python2.4/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.4/cmd.py", line 219, in onecmd
    return func(arg)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 623, in do_syncOneUser
    user_rec = self._FetchOneUser(username)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 916, in _FetchOneUser
    self._PrintGoogleUserRec(user_rec)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 1026, in _PrintGoogleUserRec
    print '%-30s: %s' % (str(key), str(val))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in
position 3: ordinal not in range(128)

What version of the product are you using? On what operating system?

Revision: 59. Linux.

Please provide any additional information below.

Changing command.py, line 1026 from:

      print '%-30s: %s' % (str(key), str(val))

to:

      print '%-30s: %s' % (str(key), val)

it works.

Original issue reported on code.google.com by eduardo....@gmail.com on 6 Mar 2008 at 12:56