gnome-games r7818 - in trunk/glchess/src/lib: . chess scene/opengl



Author: rancell
Date: Thu Aug 14 13:58:17 2008
New Revision: 7818
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7818&view=rev

Log:
Use Exception.message or IOException.strerror instead of Exception.args as the former is guaranteed to exist and the latter may be a zero length list (Bug #541788)


Modified:
   trunk/glchess/src/lib/chess/pgn.py
   trunk/glchess/src/lib/main.py
   trunk/glchess/src/lib/scene/opengl/png.py
   trunk/glchess/src/lib/scene/opengl/texture.py

Modified: trunk/glchess/src/lib/chess/pgn.py
==============================================================================
--- trunk/glchess/src/lib/chess/pgn.py	(original)
+++ trunk/glchess/src/lib/chess/pgn.py	Thu Aug 14 13:58:17 2008
@@ -389,7 +389,7 @@
         """
         if self._isValidTagName(name) is False:
             raise Error('%s is an invalid tag name' % str(name))
-        
+
         # If no value delete
         if value is None:
             # If is a STR tag throw an exception
@@ -557,7 +557,7 @@
                 p.parseLine(line)
             p.complete()
         except Error, e:
-            raise Error('Error on line %d: %s' % (lineNumber, e.args[0]))
+            raise Error('Error on line %d: %s' % (lineNumber, e.message))
 
         # Must be at least one game in the PGN file
         self.__games = p.games

Modified: trunk/glchess/src/lib/main.py
==============================================================================
--- trunk/glchess/src/lib/main.py	(original)
+++ trunk/glchess/src/lib/main.py	Thu Aug 14 13:58:17 2008
@@ -308,7 +308,7 @@
                 f.write('\n')
                 f.close()
             except IOError, e:
-                return e.args[1]
+                return e.strerror
 
         self.setNeedsSaving(False)
         self.application.logger.addLine('Saved game %s to %s' % (repr(self.name), self.fileName))

Modified: trunk/glchess/src/lib/scene/opengl/png.py
==============================================================================
--- trunk/glchess/src/lib/scene/opengl/png.py	(original)
+++ trunk/glchess/src/lib/scene/opengl/png.py	Thu Aug 14 13:58:17 2008
@@ -699,7 +699,7 @@
             try:
                 tag, data = self.read_chunk()
             except ValueError, e:
-                raise Error('Chunk error: ' + e.args[0])
+                raise Error('Chunk error: ' + e.message)
 
             # print >> sys.stderr, tag, len(data)
             if tag == 'IHDR': # http://www.w3.org/TR/PNG/#11IHDR

Modified: trunk/glchess/src/lib/scene/opengl/texture.py
==============================================================================
--- trunk/glchess/src/lib/scene/opengl/texture.py	(original)
+++ trunk/glchess/src/lib/scene/opengl/texture.py	Thu Aug 14 13:58:17 2008
@@ -52,7 +52,7 @@
         try:
             (width, height, data, metaData) = reader.read()
         except png.Error, e:
-            print 'Error loading texture %s: %s' % (fileName, e.args[0])
+            print 'Error loading texture %s: %s' % (fileName, e.message)
             self.__data = None
             return
         



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