My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 301: TypeError: list items should be of form (string,int,int)
3 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jan 2008
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by gothicx, Jan 22, 2008
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
Comment 1 by g3ntaro, Jan 22, 2008
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
Comment 2 by gbtami, Jan 23, 2008
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?
Comment 3 by ste...@xsteve.at, Jan 23, 2008
I have the same problem on ubuntu gutsy, AMD64

I started it from the svn checkout:
PYTHONPATH=lib/ ./pychess
Comment 4 by ste...@xsteve.at, Jan 23, 2008
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
Comment 5 by lobais, Jan 23, 2008
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.
Comment 6 by gothicx, Jan 24, 2008
This bug is also happening in Debian, so people can't run it.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=462374
Comment 7 by gothicx, Jan 24, 2008
How about to release a beta 5 with this fix and some others that are in svn ?
Comment 8 by varunhiremath, Jan 24, 2008
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
Comment 9 by lobais, Jan 25, 2008
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.
Status: Fixed
Sign in to add a comment

Hosted by Google Code