On Mon, 29 Jul 2013 16:56:06 -0400, Devyn Collier Johnson wrote:

> collier@Nacho-Laptop:~$ ./pyglet.py

Here you are running a module called pyglet, which I assume you wrote.


> Traceback (most recent call last):
>    File "./pyglet.py", line 2, in <module>
>      import pyglet

And here you try to import the third-party module called pyglet, except 
it is shadowed by your module, and you get your own module instead.

>    File "/home/collier/pyglet.py", line 3, in <module>
>      song = pyglet.media.load('./boot.ogg')
> AttributeError: 'module' object has no attribute 'media'

Since your module has no attribute 'media', that error is correct.



The lesson here is, never name your own files the same as library files. 
Unfortunately, that's easier said than done. I think everyone has made 
the same mistake at least once in their life as a Python programmer.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to