Unicode error with ado in win 32

Neo neo at thezion.net
Wed Feb 21 20:10:04 CET 2001


I've created a simple script which read and print on the interactive window
the data from a database field (sql server 7).
It work properly but when into the rs.fields('azienda') theres the string
"abbà" the script returns the following message.

Traceback (most recent call last):
  File "g:\programmi\Python20\Pythonwin\pywin\framework\scriptutils.py",
line 298, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File "g:\programmi\Python20\Pythonwin\pywin\debugger\__init__.py", line
60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File "g:\programmi\Python20\Pythonwin\pywin\debugger\debugger.py", line
582, in run
    _doexec(cmd, globals, locals)
  File "g:\programmi\Python20\Pythonwin\pywin\debugger\debugger.py", line
921, in _doexec
    exec cmd in globals, locals
  File "G:\Programmi\Python20\fede.py", line 12, in ?
    print unicode(a)
  File "g:\programmi\Python20\win32com\client\dynamic.py", line 165, in
__str__
    return str(self.__call__())
UnicodeError: ASCII encoding error: ordinal not in range(128)

I've try to translate the string into my regional unicode character set, but
it not work.

Help me please.

The strange kind is that using an ODBC connection this error not appear.
Thanks.



--
Neo
****************************
Follow the White Rabbit...
Knock Knock Neo...
www.thezion.net
****************************

Below there's the block code that i've used.

Bye


dataconn.Open (strConn)
sql="select * from GpAzienda ;"
rs.Open(sql, dataconn)
while not rs.eof:
    a = gettext.gettext(rs.Fields('azienda'))
    print a
    rs.MoveNext()

del rs
del dataconn






More information about the Python-list mailing list