我正在使用Python 2.6.6和pyglet 1.1.4.在我的"Erosion"文件夹中,我有"Erosion.py"和一个名为"Images"的文件夹.在图像内部,有.png图像.一张图片名为"Guard.png".
在"Erosion.py"中有一段如下:
pyglet.resource.path = ['Images']
pyglet.resource.reindex()
self.image = pyglet.resource.image('%s%s' % (character, '.png'))
Run Code Online (Sandbox Code Playgroud)
当我跑这个,我得到了
File "C:\Python26\lib\site-packages\pyglet\resource.py", line 394, in file raise ResourceNotFoundException(name)
ResourceNotFoundException: Resource "Guard.png" was not found on the path. Ensure that the filename has the correct captialisation.
Run Code Online (Sandbox Code Playgroud)
我尝试将路径更改为['./''和['../Images'].我也尝试删除路径和reindex调用,并将Erosion.py和Guard.png放在同一个文件夹中.
pyglet ×1