I know this is super old, but for me it was caused by installing just
"cocos" from pip, then i tried installing cocos2d and the two modules like
merged into the same folder. so just delete the directory and install
cocos2d with pip again.
On Thursday, February 4, 2016 at 8:21:15 PM UTC-5, Michael Calvey wrote:
>
> Hello all,
>
> I am brand new to cocos, and I am trying to find the best engine/ library
> for a top down game I am about to start working on. While going through the
> hello world exercise in the docs, I am receiving an AttributeError.
>
> Here is the code:
> import cocos
>
> class HelloWorld(cocos.layer.Layer):
>
> def __init__(self):
> super( HelloWorld, self).__init__()
>
> label = cocos.text.Label('Hello, world',
> font_name='Times New Roman',
> font_size=32,
> anchor_x='center', anchor_y='center')
> label.position = 320,240
> self.add( label )
> cocos.director.director.init()
> hello_layer = HelloWorld ()
> main_scene = cocos.scene.Scene (hello_layer)
> cocos.director.director.run (main_scene)
>
> And the traceback:
> Traceback (most recent call last):
> File "/Users/michaelcalvey/Documents/cocos.py", line 1, in <module>
> import cocos
> File "/Users/michaelcalvey/Documents/cocos.py", line 4, in <module>
> class HelloWorld(cocos.layer.Layer):
> AttributeError: module 'cocos' has no attribute 'layer'
>
> Thanks a lot for the help, sorry if it is an obvious problem but I have
> looked around and haven't found anything relevant.
> I am really looking forward to getting this to work!
>
> Michael
>
>
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/cocos-discuss/99b74837-47d4-48ca-bb7a-a68e66dd653b%40googlegroups.com.