On 16 August 2016 at 11:01, Mike Dewhirst <[email protected]> wrote:
> If anyone can point me to the appropriate advice for resolving the error
> below I would be most appreciative. Really very appreciative.
>
> I think I understand Unicode in theory and have reread a lot of articles
> including ...

The article we recommend for getting a good grasp is
http://nedbatchelder.com/text/unipain.html or Joel Spolsky's article
on the subject.

>     print("%s" % cells)

Bit of a red flag.  print("%s" % x) seems a funny way to write print(x).

>                 cells = list(line)

This is a list of characters, not a list of comma-separated values.
Perhaps you wanted cells = line.split(',') or the CSV module which
will handle quoted values too.

> I have tried utf-8 encoding each line and that gets past the error but just
> produces a set of chars a snippet of which below [2].
> Decoding that as utf-8
> reproduces the error as might be expected. I have also tried decoding as
> utf-16 and encoding it as utf-8 but that didn't work either.

As for the encode error, this tells you that it is trying to convert
some text into bytes.  I'm not sure if it is sys.stdout.write that is
failing to do this, or the %.  What is the value of
sys.stdout.encoding at this point?

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law.  You absolutely MAY reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in.  Any attempt to DENY YOU THOSE RIGHTS would be illegal without
prior contractual agreement.
_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to