[Monetdb-developers] a little unicode fix in MapiClient.py

Max amv_cbx at mail.ru
Sun May 14 09:21:45 CEST 2006


Steps to reproduce problem:
1. MonetDB-4.10.2, Python 2.3.4, Gentoo Linux 2005.0,  LANG=ru_RU.KOI8-R
2. Start monetdb mil server
3. Start MapiClient.py
4. Type following command:  vars();
5. Script fails with the following output:

#MapiClient (python) connected to localhost:50000 as max
> vars();
Traceback (most recent call last):
  File "/usr/bin/MapiClient.py", line 77, in ?
    main(sys.argv)
  File "/usr/bin/MapiClient.py", line 60, in main
    res = s.cmd(line)
  File "/usr/share/MonetDB/python/Mapi.py", line 116, in cmd
    return self.result()
  File "/usr/share/MonetDB/python/Mapi.py", line 67, in result
    while buffer[-len(self.prompt1):] != self.prompt1 and \
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 0: ordinal not in range(128)

Possible patch:

--- MonetDB-4.10.2/src/mapi/clients/python/MapiClient.py.in     2006-01-20 23:36:49.000000000 +0700
+++ MonetDB-4.10.2/src/mapi/clients/python/MapiClient.py.in.fixed       2006-05-14 15:15:19.000000000 +0800
@@ -57,7 +57,7 @@
     sys.stdout.write(s.prompt)
     line = fi.readline()
     while line and line != "quit;\n":
-        res = s.cmd(line)
+        res = s.cmd(line).encode('utf-8')
         print res
         sys.stdout.write(s.prompt.encode('utf-8'))
         line = fi.readline()





More information about the developers-list mailing list