The image file is in the exact same directory (no need to specify a
file path). That's why it is so bizarre.

As I've said before, I've done weirder things and they all work (a
fake layer engine using sprites, for example), but for some reason
this basic one doesn't. I have to be literally clicking on the icon to
get it to work 'cause IDLE won't run it (pressing F5).

I wanted to start programming some draggeable objects, but I'm stumped
by this stuff. It must be 'cause I'm just too stubborn, but I just
can't proceed if I don't exactly know what is wrong here.

On 6 mar, 00:44, Richard Jones <[email protected]> wrote:
> Where is kitten.jpg located? Is it in the same directory as your program?
>
> How are you running your program when it's not double-clicked?
>
> By default pyglet's resource module only adds the *current working
> directory* to the resource path. See the resource module's docs for
> info on how to extend that.
>
>        Richard
>
> On Sat, Mar 6, 2010 at 6:44 PM, Alejandro Castellanos
>
> <[email protected]> wrote:
> > So, I was finally dusting my old pyglet skills after a good, long
> > while of not using them and ended up stumbling into this weird,
> > bizarre problem, even with the bundled examples for pyglet 1.1.4.
>
> > All I ever wanted was to show an image on screen, period. I've done
> > weirder things.
>
> > Here's the code that mostly about everyone should be familiar with:
>
> > ----------------------------------------
>
> > import pyglet
>
> > window = pyglet.window.Window()
> > image = pyglet.resource.image('kitten.jpg')
>
> > @window.event
> > def on_draw():
> >    window.clear()
> >    image.blit(0, 0)
>
> > pyglet.app.run()
>
> > ------------------------------------
>
> > And here's the error message:
> > -----------------------------------------------
>
> > Traceback (most recent call last):
> >  File "C:\Users\alejandro\Downloads\pyglet-1.1.4-docs\examples
> > \programming_guide\image_viewer.py", line 45, in <module>
> >    image = pyglet.resource.image('kitten.jpg')
> >  File "C:\Python26\lib\site-packages\pyglet\resource.py", line 492,
> > in image
> >    identity = self._cached_images[name] = self._alloc_image(name)
> >  File "C:\Python26\lib\site-packages\pyglet\resource.py", line 436,
> > in _alloc_image
> >    file = self.file(name)
> >  File "C:\Python26\lib\site-packages\pyglet\resource.py", line 394,
> > in file
> >    raise ResourceNotFoundException(name)
> > ResourceNotFoundException: Resource "kitten.jpg" was not found on the
> > path.  Ensure that the filename has the correct captialisation.
>
> > -----------------------------------------------
>
> > The odd thing is that if I double-click on the file, it executes and
> > shows the image of the kitty, not a problem.
>
> > Weird, I say.
>
> > I don't know if the problem is with IDLE, or the version number
> > (1.1.4), or my OS (Vista, 64 bits)...or a combination of all of those.
>
> > I've done this a million times, and I don't know what could be wrong.
>
> > Thanks in advance.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "pyglet-users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/pyglet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to