Re: [pygame] Problem with pytmx and tiled

2015-07-13 Thread Daniel Foerster

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?


Re: [pygame] Problem with pytmx and tiled

2015-07-13 Thread Ian Mallett
​Assuming you're using a PyTMX version > 2.16.5, this looks like a bug in
its Python 3 support.

I'd try replacing "data = b64decode(data_node.text.strip())" with something
like "data = b64decode(data_node.text.strip().encode())" and seeing if that
improves anything. But this isn't a PyGame issue.

Ian


[pygame] Problem with pytmx and tiled

2015-07-13 Thread ck421
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?





--
View this message in context: 
http://pygame-users.25799.x6.nabble.com/Problem-with-pytmx-and-tiled-tp2028.html
Sent from the pygame-users mailing list archive at Nabble.com.