hp 11.11 64 bit python 2.5 build gets error "import site failed"

Leo Kislov Leo.Kislov at gmail.com
Fri May 4 01:17:22 EDT 2007


On May 3, 2:54 pm, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> >>> "import site failed"
> >>> OverflowError: signed integer is greater than the maximum.
> >> - what is the value of ival?
> > ival: 4294967295
>
> I see. This is 0xFFFFFFFF, which would be -1 if it were of type
> int. So perhaps some value got cast incorrectly at some point,
> breaking subsequent computations
>
>
>
> >> - where does that number come from?
>
> > It is coming from the call to PyInt_AsLong. In that function there is
> > a call to:
> > PyInt_AS_LONG((PyIntObject*)op)
> > which returns the value of ival.
>
> That was not my question, really. I wanted to know where the object
> whose AsLong value was taken came from. And before you say "it's
> in the arg parameter" of convertsimple() - sure it is. However, how
> did it get there? It's in an argument tuple - and where came
> that from?

Looking at the call stack OP posted, -1 is coming as forth parameter
of
__import__, I *guess* at the first import in site.py or at implicit
"import site". I think it'd be helpful if OP also tried if it works:
python -S -c -v "print -1, type(-1), id(0), id(-1)"


  -- Leo




More information about the Python-list mailing list