Re: Has anyone gotten Pyglet to work

On 07/29/2013 05:08 PM, Gary Herron wrote:
> 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@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. :^) )
>
>
>
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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!