pygsear-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygsear] error on penguin.py


From: Lee Harr
Subject: Re: [pygsear] error on penguin.py
Date: Tue, 08 Apr 2003 18:40:24 +0000

I get this error when trying to run penguin.py in Gentoo linux, Python2.2.2

python penguin.py
Traceback (most recent call last):
  File "penguin.py", line 917, in ?
    demo.mainloop()
  File "penguin.py", line 883, in mainloop
    random.shuffle(funcs)
  File "/usr/lib/python2.2/random.py", line 373, in shuffle
    j = int(random() * (i+1))
OverflowError: float too large to convert



Hmm... strange. Here's the code from mainloop:

       funcs = self.pete.testfuncs()
       random.shuffle(funcs)

funcs should just be a list of about 30 or so strings. Try
printing it out instead of shuffling:

       funcs = self.pete.testfuncs()
       print funcs
       #random.shuffle(funcs)


Now, in random.shuffle:

       for i in xrange(len(x)-1, 0, -1):
           # pick an element in x[:i+1] with which to exchange x[i]
           j = int(random() * (i+1))
           x[i], x[j] = x[j], x[i]

where x is the list to shuffle.


To me this looks like a problem with your python installation.
I remember seeing a few weeks ago people reporting some weird
stuff between python gentoo and glibc.

What happens if you do this:

14:21 >python
Python 2.2 (#1, Jan 23 2002, 06:46:11)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.

import random
l=[1, 2, 3, 4, 5]
random.shuffle(l)
l
[2, 3, 5, 4, 1]



Strange that it would just show up now. Did you recently upgrade
your gentoo or python?


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail





reply via email to

[Prev in Thread] Current Thread [Next in Thread]