Has anyone gotten Pyglet to work

Gary Herron gary.herron at islandtraining.com
Mon Jul 29 23:08:33 CEST 2013


On 07/29/2013 01:56 PM, Devyn Collier Johnson wrote:
> I tried Pyglet in a Python3 and a Python2 script, but both fail. The 
> error code is below and the script is attached. The 'boot.ogg' file is 
> Ubuntu's default bootup sound. I got my code from this link 
> (http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html).
>
> collier at Nacho-Laptop:~$ ./pyglet.py
> Traceback (most recent call last):
>   File "./pyglet.py", line 2, in <module>
>     import pyglet
>   File "/home/collier/pyglet.py", line 3, in <module>
>     song = pyglet.media.load('./boot.ogg')
> AttributeError: 'module' object has no attribute 'media'
>
>
> Mahalo,
>
> DCJ
>
>

You appear to have confused Python by having a module named pyglet AND a 
local file named pyglet.py.

This when you say import pyglet, you are not getting the pyglet module, 
but instead your own file pyglet.py, which of course, has nothing named 
media in it.

Rename your file and try again.

P.S.  It is a common newbie error to hide a system file like this and 
suffer the consequence.  We've all done it -- at least once. :^) )

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130729/1dafca35/attachment.html>


More information about the Python-list mailing list