Win32 question: Problem with NetLocalGroupDelMembers

Marten Hedman marten.hedman at btk.utu.fi
Fri Sep 6 08:45:04 EDT 2002


Hi,

Im writing a script for administrating local user groups on a remote 
WinNT computer, using Python 2.2.1 and the Win32 extensions, build 148. 
Getting information about users in a group and adding users to a group 
works fine, but when I try to delete users from a group I get an 
exception, 'TypeError: The object can not be converted to a Unicode 
object'. An interactive example session looks like this:

PythonWin 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au) - 
see 'Help/About PythonWin' for further copyright information.
 >>> import win32net
 >>> server = '\\\\LAVENDER'
 >>> level = 3
 >>> uname = 'BTK\\testperson'
 >>> group = 'testgroup'
 >>> u={}
 >>> u['domainandname'] = uname
 >>> u=[u]
 >>> u
[{'domainandname': 'BTK\\testperson'}]
 >>> win32net.NetLocalGroupAddMembers(server, group, level, u)
 >>> mem, tot, res = win32net.NetLocalGroupGetMembers(server, group, level)
 >>> mem
[{'domainandname': u'BTK\\testperson'}]
 >>> win32net.NetLocalGroupDelMembers(server, group, mem)
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
TypeError: The object can not be converted to a Unicode object
 >>> win32net.NetLocalGroupDelMembers(server, group, u)
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
TypeError: The object can not be converted to a Unicode object
 >>>

Have I misunderstood something, or have I stumbled upon a bug?
Any help would be apprciated.

Yours,

Marten Hedman
Systems Administrator
Turku Centre for Biotechnology
Turku, Finland




More information about the Python-list mailing list