Mercurial > nagslang
comparison nagslang/resources.py @ 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 | 197a41520ad1 |
children |
comparison
equal
deleted
inserted
replaced
669:30ae339d7224 | 670:87c6ede3b10b |
---|---|
1 import os | 1 import os |
2 import sys | 2 import sys |
3 | 3 |
4 from pkg_resources import resource_filename | 4 try: |
5 from pkg_resources import resource_filename | |
6 except ImportError: | |
7 # OK, we're most likely running under py2exe, so this is safe | |
8 # (for values of safe that are unconcerned about py2exe being involved) | |
9 def resource_filename(mod, path): | |
10 # There are better ways of doing this, but I've spent too much | |
11 # time going down this rabbithole already | |
12 return os.path.join(os.path.dirname(__file__), '..', 'data', path) | |
5 import pygame | 13 import pygame |
6 | 14 |
7 | 15 |
8 class ResourceNotFound(Exception): | 16 class ResourceNotFound(Exception): |
9 pass | 17 pass |