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

Fabian Groffen Fabian.Groffen at cwi.nl
Sun May 14 10:19:41 CEST 2006


Hi Max,

Thanks for your interest in MonetDB and your patch.

On 14-05-2006 11:21:45 +0400, Max wrote:
> Steps to reproduce problem:
> 1. MonetDB-4.10.2, Python 2.3.4, Gentoo Linux 2005.0,  LANG=ru_RU.KOI8-R

Just for the record, are you running x86, ppc, amd64...?

> #MapiClient (python) connected to localhost:50000 as max
> > vars();
> Traceback (most recent call last):
[snip]
>   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()

Your patch looks most reasonable to me, but I'm not a python expert.
Maybe Niels or Sjoerd can have a look at this.  This patch solves the
problem for you, right?  I guess in your vars there are some paths with
Russian characters which triggers the problem, or something like that?

Regards




More information about the developers-list mailing list