Pyglet resources not loading
pyglet.resource.ResourceNotFoundException: Resource "data/queen.png" was not found on the path. Ensure that the filename has the correct captialisation
Cosmo and Rectifier pointed out a bug:pyglet.resource has a cache. This cache gets invalidated by the previous games you played (but didn't happen on my machine, as I played my game first).
Cosmo fixed it by adding (at the top of run_game.py) :
pyglet.resource.path = ['data']
pyglet.resource.reindex()
and removing "data/" from all the resouce loads.
It might be possible to just do:
pyglet.resource.path = ['.']
pyglet.resource.reindex()
(log in to comment)
Comments
Are you certain that the problem isn't one of capitalisation as mentioned in the error?
christopher@palimpsest:~/Downloads/PyWeek-13-finals/mustache/mustache_day$ ls -hog data/blob.png
-rw-r--r-- 1 537K 2011-09-17 17:43 data/blob.png
christopher@palimpsest:~/Downloads/PyWeek-13-finals/mustache/mustache_day$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyglet
>>> pyglet.resource.texture('data/blob.png')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 599, in texture
file = self.file(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 383, in file
raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "data/blob.png" was not found on the path. Ensure that the filename has the correct captialisation.
>>> pyglet.resource.path = ['.']
>>> pyglet.resource.reindex()
>>> pyglet.resource.texture('data/blob.png')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 599, in texture
file = self.file(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 383, in file
raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "data/blob.png" was not found on the path. Ensure that the filename has the correct captialisation.
>>> pyglet.resource.path = ['data']
>>> pyglet.resource.reindex()
>>> pyglet.resource.texture('blob.png')
<Texture 512x512>
Cosmologicon on 2011/09/24 03:00:
I'm running into this issue with a number of pyglet games. I'm curious why reindexing is required on some systems and not others, apparently. Does anyone know? Is it an operating system difference?