<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 07/29/2013 05:08 PM, Gary Herron
wrote:<br>
</div>
<blockquote cite="mid:51F6D9D1.7080709@islandtraining.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 07/29/2013 01:56 PM, Devyn Collier
Johnson wrote:<br>
</div>
<blockquote cite="mid:51F6D6E6.2070004@Gmail.com" type="cite">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 (<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html">http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html</a>).
<br>
<br>
collier@Nacho-Laptop:~$ ./pyglet.py <br>
Traceback (most recent call last): <br>
File "./pyglet.py", line 2, in <module> <br>
import pyglet <br>
File "/home/collier/pyglet.py", line 3, in <module> <br>
song = pyglet.media.load('./boot.ogg') <br>
AttributeError: 'module' object has no attribute 'media' <br>
<br>
<br>
Mahalo, <br>
<br>
DCJ <br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
You appear to have confused Python by having a module named pyglet
AND a local file named pyglet.py.<br>
<br>
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.<br>
<br>
Rename your file and try again. <br>
<br>
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.
:^) )<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
Duh, thanks for the tip (^u^), but I still get an error (different
error). NOTE: this is all python2.7 code because Pyglet supposedly
has issues with Python3.<br>
<br>
collier@Nacho-Laptop:~$ pip install pyglet<br>
Downloading/unpacking pyglet<br>
Downloading pyglet-1.1.4.tar.gz (2.9MB): 2.9MB downloaded<br>
Running setup.py egg_info for package pyglet<br>
.......Blah........<br>
.......Blah........<br>
Installing collected packages: pyglet<br>
Running setup.py install for pyglet<br>
Successfully installed pyglet<br>
Cleaning up...<br>
collier@Nacho-Laptop:~/pytest$ ./pymedia.py<br>
Traceback (most recent call last):<br>
File "./pymedia.py", line 3, in <module><br>
song = pyglet.media.load('./boot.ogg')<br>
File
"/usr/local/lib/python2.7/dist-packages/pyglet/media/__init__.py",
line 1386, in load<br>
source = _source_class(filename, file)<br>
File
"/usr/local/lib/python2.7/dist-packages/pyglet/media/riff.py", line
202, in __init__<br>
'AVbin is required to decode compressed media')<br>
pyglet.media.riff.WAVEFormatException: AVbin is required to decode
compressed media<br>
AL lib: ReleaseALC: 1 device not closed<br>
collier@Nacho-Laptop:~/pytest$ ls<br>
boot.ogg pymedia.py<br>
<br>
<br>
<br>
Mahalo,<br>
<br>
DCJ<br>
</body>
</html>