[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Problem with pytmx and tiled



On 07/13/2015 09:01 AM, ck421 wrote:
Hello,

I am new to these forums and to pygame in general. I have been trying to use
pytmx in order to load in a tiled .tmx file but I keep getting this error:

File "C:\Python32\lib\site-packages\pytmx\pytmx.py", line 258, in __init__
     self.parse_xml(ElementTree.parse(self.filename).getroot())
   File "C:\Python32\lib\site-packages\pytmx\pytmx.py", line 280, in
parse_xml
     self.add_layer(TiledTileLayer(self, subnode))
   File "C:\Python32\lib\site-packages\pytmx\pytmx.py", line 821, in __init__
     self.parse_xml(node)
   File "C:\Python32\lib\site-packages\pytmx\pytmx.py", line 864, in
parse_xml
     data = b64decode(data_node.text.strip())
   File "C:\Python32\lib\base64.py", line 83, in b64decode
     raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not str

I am running python 3.2.4 and pygame 3.2. The code I am trying to run is
this:

import sys, pygame, pytmx
from pygame.locals import *

tiled_map = pytmx.TiledMap("map.tmx")

Like I said, I am new to this entire interface, so could anyone help me
figure out this problem?
I suspect that you are using an older version of PyTMX that doesn't have Py3 support. How did you get the library?