rajrakeshdr / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

TypeError: list items should be of form (string,int,int) #301

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
desktop:~$ pychess
Traceback (most recent call last):
  File "/usr/games/pychess", line 41, in <module>
    pychess.Main.run(sys.argv[1:])
  File "/usr/lib/python2.5/site-packages/pychess/Main.py", line 468, in run
    PyChess(args)
  File "/usr/lib/python2.5/site-packages/pychess/Main.py", line 400, in
__init__
    self.initGlade()
  File "/usr/lib/python2.5/site-packages/pychess/Main.py", line 433, in
initGlade
    window["menubar1"].drag_dest_set(flags, dnd_list, gtk.gdk.ACTION_COPY)
TypeError: list items should be of form (string,int,int)

This happens with pychess 0.8 beta 4 in Ubuntu Gutsy. It builds fine, but
get this error when run it.

Thanks

Original issue reported on code.google.com by goth...@gmail.com on 22 Jan 2008 at 6:58

GoogleCodeExporter commented 9 years ago
Same error happens on my Gentoo. 

games-board/pychess-0.8_beta4

dev-python/gst-python-0.10.9
dev-python/pysqlite-2.3.5
dev-lang/python-2.4.4-r6
dev-python/pygtk-2.12.0

Original comment by g3nt...@gmail.com on 22 Jan 2008 at 11:01

GoogleCodeExporter commented 9 years ago
I cant reproduce this on my Gutsy.
I'v installed it with extracting it from .tar.gz then:
python setup.py install

How _exactly_ did you installed it?

Original comment by gbtami on 23 Jan 2008 at 5:28

GoogleCodeExporter commented 9 years ago
I have the same problem on ubuntu gutsy, AMD64

I started it from the svn checkout:
PYTHONPATH=lib/ ./pychess

Original comment by stefan.r...@gmail.com on 23 Jan 2008 at 7:12

GoogleCodeExporter commented 9 years ago
I did some more research.

% svn update -r 828                                                             

At revision 828.
% PYTHONPATH=lib/ ./pychess

This version works

% svn update -r 829                                                             

At revision 829.
% PYTHONPATH=lib/ ./pychess

This version does not work

% svn diff . -r 828
Index: lib/pychess/widgets/newGameDialog.py
===================================================================
--- lib/pychess/widgets/newGameDialog.py        (revision 828)
+++ lib/pychess/widgets/newGameDialog.py        (working copy)
@@ -182,6 +182,9 @@
             if res != gtk.RESPONSE_ACCEPT:
                 return
         else:
+            if not uri[uri.rfind(".")+1:] in ionest.enddir:
+                log.log("Ignoring strange file: %s" % uri)
+                return
             cls.loadSidePanel.set_filename(uri)
             cls.filechooserbutton.emit("file-activated")

Index: lib/pychess/Main.py
===================================================================
--- lib/pychess/Main.py (revision 828)
+++ lib/pychess/Main.py (working copy)
@@ -383,8 +383,9 @@
             ICLogon.dialog.widgets["passEntry"].set_text(password)
             ICLogon.dialog.widgets["connectButton"].clicked()

-TARGET_TYPE_URI_LIST = 80
-dnd_list = [ ( 'text/plain', 0, TARGET_TYPE_URI_LIST ) ]
+dnd_list = [ ('application/x-chess-pgn', 0, hash("pychess")),
+             ('application/da-chess-pgn', 0, hash("pychess")),
+             ('text/plain', 0, hash("pychess")) ]
 from gtk import DEST_DEFAULT_MOTION, DEST_DEFAULT_HIGHLIGHT, DEST_DEFAULT_DROP

 class PyChess:

It seems that the dnd_list causes the problem

Original comment by stefan.r...@gmail.com on 23 Jan 2008 at 7:22

GoogleCodeExporter commented 9 years ago
Perhaps some versions of pygtk want lists rather than tuples.
I don't think there is a reason for this, so it is probably a bug in pygtk.

However as the dnd_list change serves no purpose - we still need to include
text/plain in order to accept fens and epds - it can safely be reverted.

Original comment by lobais on 23 Jan 2008 at 9:04

GoogleCodeExporter commented 9 years ago
This bug is also happening in Debian, so people can't run it.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=462374

Original comment by goth...@gmail.com on 24 Jan 2008 at 11:43

GoogleCodeExporter commented 9 years ago
How about to release a beta 5 with this fix and some others that are in svn ?

Original comment by goth...@gmail.com on 24 Jan 2008 at 11:45

GoogleCodeExporter commented 9 years ago
Hi, 
I was trying to debug this today, and I found that the bug is actually 
related to the hash function used.

On i386 hash("pychess") returns: -37102208
On amd64 hash("pychess") returns: -40460623484953216 
(which I guess is going out of int range)

If I replace hash("pychess") with a lower number it works on amd64. 
So, you may want to use a hard coded number instead of hash.

Thanks
Varun

Original comment by varunhir...@gmail.com on 25 Jan 2008 at 5:56

GoogleCodeExporter commented 9 years ago
Nice catch. If you read the hash documentation, it says: "hash(object) -> 
integer",
so I guess you could also submit it to python upstream.

Revision 875 changes hash("pychess") to the int 0xBadbeef.

Original comment by lobais on 25 Jan 2008 at 5:16