Teamstrong - not finding a resource

pyglet.resource.ResourceNotFoundException: Resource "theme.json" was not found on the path.  Ensure that the filename has the correct captialisation.

I've checked the capitalisation and it seems to be correct.

Full traceback below.

Traceback (most recent call last):
  File "run_game.py", line 1, in <module>
    import teamstrong.__main__
  File "/Local/Games/PyWeek12/Unpack/teamstrong-1.0.2/teamstrong/__main__.py", line 8, in <module>
    import ui
  File "/Local/Games/PyWeek12/Unpack/teamstrong-1.0.2/teamstrong/ui.py", line 20, in <module>
    themes = [ui.Theme(data.filepath('themes/pywidget'))]
  File "/Local/Games/PyWeek12/Unpack/teamstrong-1.0.2/teamstrong/simplui/theme.py", line 51, in __init__
    input = json.loads( loader.file('theme.json').read() )
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyglet/resource.py", line 394, in file
    raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "theme.json" was not found on the path.  Ensure that the filename has the correct captialisation.

(log in to comment)

Comments

Found the problem. It's this piece of code in teamstrong/data.py:

if 'python' in sys.executable:
    data_py = os.path.abspath(os.path.dirname(__file__))
else:
    data_py = os.path.abspath(os.path.dirname(sys.executable))

the problem is that on my system (MacOSX framework installation) sys.executable is "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python", which doesn't include "python" in lower case, so it looks in the wrong place for resources.

If anyone else encounters this, the fix is to comment out the test and just leave this line:

data_py = os.path.abspath(os.path.dirname(__file__))
Good work finding and reporting that bug, it would have been frustrating to track down.