Don't know what else to try

John Machin sjmachin at lexicon.net
Sat Nov 15 22:57:10 CET 2008


On Nov 16, 12:12 am, Gilles Ganault <nos... at nospam.com> wrote:
> On Fri, 14 Nov 2008 17:39:00 +0100, "Martin v. Löwis"
>
> <mar... at v.loewis.de> wrote:
> >Can you first please report what happened when you add the print statement?
>
> Thanks guys, I found how to handle this:

No you didn't.

>
> ===========
> for id in rows:
>         #Says Unicode, but it's actually not

If it's not unicode, what is it? What is your basis for that assertion
(which implies there is a bug in the version of Python that you are
using)? The probability that type() ever become so buggy that it
misreports whether a value is unicode or not, is extremely small.
Further the probability that you or I would be the first to notice the
problem is vanishingly small.

>         #print type(id[1])
>         #<type 'unicode'>

You didn't reply to Martin's question, instead you are tilting at a
windmill whose probability of existence lies between epsilon and zero.
When you ask for help, you should act on reasonable requests from your
helpers. Here's a reasonable request; insert some more verbose
debugging code:
          print 'id[1] is', type(id[1]), repr(id[1])
AND tell us what you see, *before* you try to "fix" it.

For the future, please remember these:
(1) When you are worried about exactly what data some name refers to,
do
   print 'name is', type(name), repr(name)
(2) Examine the more plausible sources of error first ... here's a
partial ordering: Ganault, ..., Gates, ..., Guido, God :-)

HTH,
John



More information about the Python-list mailing list