[python-win32] Null provokes unicode error.

Peter Jessop pjessop at gmail.com
Tue Aug 23 12:33:27 CEST 2005


Good day all:

I have a trivial problem that I would be grateful for help with.
I am running python 2.4.1 with Python for Windows extensions build 204.

When I run the following script after returning some lines correctly I find 
the following error. 

'Traceback (most recent call last):
File "C:\Scripts\Script2.py", line 4, in ?
print objChild.Name + '\t' + objChild.Description
TypeError: coercing to Unicode: need string or buffer, NoneType found'

This happens when the description value is null.

How do I avoid this problem?

Code
import win32com.client
objContainer = win32com.client.GetObject("LDAP://cn=users,dc=agri,dc=local")
for objChild in objContainer:
print objChild.Name + '\t' + objChild.Description


Thanks

Peter Jessop
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050823/63c51da7/attachment.htm


More information about the Python-win32 mailing list