On Wed, Jul 28, 2010 at 1:06 AM, 拿鐵 <[email protected]> wrote: > Dears, > > I am very interesting in cocos2d, so I install python 2.4 with ctypes > and pyglet 1.1.4. After doing that, I blocked with similar errors when > I try to run any *.py, I got error as below: > > C:\Src\cocos2d-0.4rc0\samples>hello_world.py > File "C:\Src\cocos2d-0.4rc0\samples\..\cocos\tiles.py", line 246, > [snip]
> in ? > from xml.etree import ElementTree > ImportError: No module named etree > > C:\Src\cocos2d-0.4rc0\samples> > > I don't know how to solve problems like this one, so please kindly > help me, thanks in advanced. > > Brian. > This module comes with python from the 2.5 version. But, before, it existed as an external package. You can download from http://effbot.org/downloads/#elementtree and install for your python 2.4 ( I tested with the source package elementtree-1.2.7-20070827-preview.zip ) And you must modify the file cocos\tiles.py : near the begin, replace the line from xml.etree import ElementTree with the block try: from xml.etree import ElementTree except ImportError: import elementtree.ElementTree as ElementTree Thats all. Fair warning: - the old elementtree package has less functionality that the python 2.5 version. - the only cocos module using this package is cocos\tiles.py , so as worst case you can notice some problems when using tilemaps; all other cocos functionality should be unaffected. - the example test_tiles.py runs ok with python 2.4 + ctypes + elementtree, so maybe the old elementtree offers all that cocos want I will correct the requirements and include the code change for the final release version. If anyone with a cocos 0.4rc0 app using tiles happen to have python 2.4... :) -- claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
