changeset 670:87c6ede3b10b

Beware py2exe's rabbitholes, for they are windy and full of teeth (no-pyflakes for good measure)
author Neil Muller <drnlmuller@gmail.com>
date Sun, 08 Sep 2013 17:53:46 +0200
parents 30ae339d7224
children 09c76e7ce675
files nagslang/resources.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nagslang/resources.py	Sun Sep 08 17:47:25 2013 +0200
+++ b/nagslang/resources.py	Sun Sep 08 17:53:46 2013 +0200
@@ -1,7 +1,15 @@
 import os
 import sys
 
-from pkg_resources import resource_filename
+try:
+    from pkg_resources import resource_filename
+except ImportError:
+    # OK, we're most likely running under py2exe, so this is safe
+    # (for values of safe that are unconcerned about py2exe being involved)
+    def resource_filename(mod, path):
+        # There are better ways of doing this, but I've spent too much
+        # time going down this rabbithole already
+        return os.path.join(os.path.dirname(__file__), '..', 'data', path)
 import pygame