I´m trying to open a tmx map with this tmx library https://github.com/renfredxh/tmx/blob/master/tmx.py
My python code looks like this:
import tmx3
import random
import math
import pygame
from socket import *
from pygame.locals import *
from random import randint
pygame.init()
screen = pygame.display.set_mode((1024,640))
tilemap = tmx3.load('map.tmx', screen.get_size())
The map.tmx i am trying to load, contains two layers. One tile layer without tile sets and one object layer with an rectangle.
I get the following error when trying to run my code:
Traceback (most recent call last):
File "C:\Users\Samy\workspace\Traveler\src\implement.py", line 12, in <module>
tilemap = tmx3.load('map.tmx', screen.get_size())
File "C:\Users\Samy\workspace\Traveler\src\tmx3.py", line 848, in load
return TileMap.load(filename, viewport)
File "C:\Users\Samy\workspace\Traveler\src\tmx3.py", line 727, in load
layer = Layer.fromxml(tag, tilemap)
File "C:\Users\Samy\workspace\Traveler\src\tmx3.py", line 261, in fromxml
data = decompress(b64decode(data))
zlib.error: Error -5 while decompressing data: incomplete or truncated stream
I printed data and the result was b''. Does anyone have a clue what is wrong here?
I found the same problem here but unanswered: Error using tmx with pygame