[game-data-packager] 04/06: optional files are optional

Alexandre Detiste detiste-guest at moszumanska.debian.org
Thu Jun 30 06:49:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch doom2-launcher
in repository game-data-packager.

commit 2a462e025a7a96b394f065db9079696e0f8a3a61
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Mon Feb 2 12:26:51 2015 +0100

    optional files are optional
---
 game_data_packager/doom2-masterlevels.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/game_data_packager/doom2-masterlevels.py b/game_data_packager/doom2-masterlevels.py
index b06d01e..520d290 100755
--- a/game_data_packager/doom2-masterlevels.py
+++ b/game_data_packager/doom2-masterlevels.py
@@ -64,8 +64,12 @@ description = dict()
 for wad in sorted(levels.keys()):
      game = os.path.splitext(os.path.basename(wad))[0]
      games.append([game, levels[wad][0] ])
-     with open('/usr/share/doc/doom2-masterlevels-wad/%s.txt' % game, 'r', encoding='latin1') as f:
-         description[game] = f.read()
+     txt = '/usr/share/doc/doom2-masterlevels-wad/%s.txt' % game
+     try:
+         with open(txt, 'r', encoding='latin1') as f:
+             description[game] = f.read()
+     except (PermissionError, FileNotFoundError):
+         description[game] = "failed to read " + txt
 
 treeview = Gtk.TreeView(model=games)
 grid.attach(treeview, 0, 0, 1, 6)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list