On 03/14/2015 08:52 AM, Chris Angelico wrote:
On Sun, Mar 15, 2015 at 2:28 AM, emile <em...@fenx.com> wrote:
It ran almost to completion before generating the error again --
(Pdb) decval
'4'
(Pdb) type(decval)
<type 'str'>
(Pdb) len(decval)
1
(Pdb) int(decval)
*** ValueError: invalid literal for int() with base 10: '41.700000000000003'
So there's still something amiss.
Compare these two lines' outputs:
print("str %d, int %d" % (id(str), id(int)))
print("str %d, int %d" % (id(type("")), id(type(0)))
(Pdb) print("str %d, int %d" % (id(str), id(int)))
str 505366496, int 505399904
(Pdb) print("str %d, int %d" % (id(type("")), id(type(0))))
str 505366496, int 505399904
Any difference in id would indicate that the names have been shadowed
- seems unlikely, but worth checking. And then, just to be absolutely
sure:
type(decval) is type("")
(Pdb) type(decval) is type("")
True
There is another, and very nasty, possibility. If you're working with
a C extension that has a refcount bug in it, all sorts of bizarre
things can happen - crucial type objects getting garbage collected,
objects getting disposed of and others taking their places, all kinds
of weird and wonderful things. Normally that'll eventually cause a
crash, but who knows...
Here're the imports:
import os, time, re, shutil, subprocess
from fenx.BBxXlate.bbxfile import BBxFile # a pure python module
from fenx import RealPyOdbc2
and of course, pdb when I break for the error condition.
Emile
--
https://mail.python.org/mailman/listinfo/python-list