[python-win32] New to Python from Perl

Gallagher, Tim (NE) Tim.Gallagher at gd-ais.com
Tue Aug 22 18:38:34 CEST 2006


Hey all I am learning Python and having a fun time doing so.  I have a question for y'all, it has to do with active directory.

I want to get the last login for a computer from Active Directory.  I am using the active_directory module and here is my code.

[START]

import active_directory

computer = active_directory.root()
for cpu in computer.search ("cn='Computer_Name'"): 
    print cpu.samAccountName				←--- Works find
    print cpu.operatingSystem				←--- Works find
    print cpu.lastLogon					←--- Getting Error

[END]


I get an error that I am not sure what to do with, the error is TypeError: coercing to Unicode: need string or buffer, instance found in my line 
Do I have to change the output to meet Unicode formation?



-T
 



More information about the Python-win32 mailing list