win32net problem and question

Jon Nials jnials at nials.org
Mon Jan 21 03:18:39 EST 2002


I am working my way (ok, jumping all over the place) through the O'Reilly
"Python programming on Win32" book and I built the following python script


import win32net
import win32netcon

def ReportServers():
    resume = 0
     serverTypes = win32netcon.SV_TYPE_ALL
     while 1:
          data, total, resume = win32net.NetServerEnum(None, 101,
serverTypes, resume)
          for server in data:
          print data
  if resume == 0:
       break

if __name__ == "__main__":
    ReportServers()


I'm getting the following traceback.....

Traceback (most recent call last):
  File "C:\Python22\Pythonwin\pywin\framework\scriptutils.py", line 301, in
RunScript
    exec codeObject in __main__.__dict__
  File "C:\tmp\PyCom\ReportServers.py", line 15, in ?
    ReportServers()
  File "C:\tmp\PyCom\ReportServers.py", line 8, in ReportServers
    data, total, resume = win32net.NetServerEnum(None, 1, serverTypes,
resume)
TypeError: The object can not be converted to a Unicode object

Which I don't understand, because it looks like the win32net code returns a
PyUnicode object which should handle it.  Anyway, I'm running this on
Windows XP.

BTW, I've picked this stuff up to learn something about Win32  programming.
I'm a unix geek, but I'm an *unemployed* unix geek

-Jon





More information about the Python-list mailing list