New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'NoneType' object has no attribute 'get' #82
Comments
Can you attach the tmx file you are using?
…On Sat, May 27, 2017 at 6:42 PM Filfire09 ***@***.***> wrote:
I was trying to use pytmx version 3.20.17 and while running code I've been
getting this error
Traceback (most recent call last):
File "/Users/fpoadmin/Desktop/pygameimages/camera.py", line 17, in
gameMap = pytmx.load_pygame('images/map RPG3.tmx')
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/util_pygame.py",
line 116, in load_pygame
return pytmx.TiledMap(filename, *args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py",
line 285, in *init*
self.parse_xml(ElementTree.parse(self.filename).getroot())
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py",
line 319, in parse_xml
self.add_layer(TiledImageLayer(self, subnode))
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py",
line 1110, in *init*
self.parse_xml(node)
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py",
line 1129, in parse_xml
self.source = image_node.get('source')
AttributeError: 'NoneType' object has no attribute 'get'
code
There is my code:
import pygame
import pytmx
pygame.init()
display_width = 800
display_height = 800
white = (255, 255, 255)
gameScreen = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('2d Game')
clock = pygame.time.Clock()
gameMap = pytmx.load_pygame('images/map RPG3.tmx')
def game_loop():
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
for layer in gameMap.visible_layers:
for x, y, gid, in layer:
tile = gameMap.get_tile_image_by_gid(gid)
gameScreen.blit(tile, (x * gameMap.tilewidth,
y * gameMap.tileheight))
pygame.display.update()
clock.tick(30)
game_loop()
pygame.quit()
The code did not really matter because I tried it with other codes and it
would give the same error.
Please help me.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#82>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAh-pwmE0-upwtUq8pss16tOGs9divoEks5r-LTjgaJpZM4NogIC>
.
|
Unfortunately, this site does not support TMX file I can't attach it.... |
Ok. You can use a pastebin. I'm not sure but it looks like maybe it can't
find an image file. Posting the tmx will help clarify that.
…On Sat, May 27, 2017 at 7:15 PM Filfire09 ***@***.***> wrote:
Unfortunately, this site does not support TMX file I can't attach it....
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAh-p-xzUdfPPCLM1XZvzsrwny3BlXtNks5r-LyzgaJpZM4NogIC>
.
|
I'm sorry what's a pastebin ? ;/ |
http://dpaste.com
Use this site to copy the contents of the tmx file
…On Sat, May 27, 2017 at 7:35 PM Filfire09 ***@***.***> wrote:
I'm sorry what's a pastebin ? ;/
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAh-p7pl-Ry6xD6YDbz-TLlKYA_RSHwnks5r-MFXgaJpZM4NogIC>
.
|
map RPG3.tmx.zip |
Thanks that worked fine. I've never seen Tiles do this, but there is an
image layer with no image. I can make a fix for it sometime in the next few
days.
If you just want it to work now, remove the layer called "Calque d'image
1", or give it an image and try again.
…On Sat, May 27, 2017 at 8:41 PM Filfire09 ***@***.***> wrote:
map RPG3.tmx.zip
<https://github.com/bitcraft/PyTMX/files/1033910/map.RPG3.tmx.zip>
Well actually I'll send you this zip file tell me if it works.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAh-p0KVb6cftw2DXW40YTdZGQa2COSMks5r-NC3gaJpZM4NogIC>
.
|
@Filfire09 has your issue been solved? |
As for me deleting empty object layer solved the problem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to use pytmx version 3.20.17 and while running code I've been getting this error
Traceback (most recent call last):
File "/Users/fpoadmin/Desktop/pygameimages/camera.py", line 17, in
gameMap = pytmx.load_pygame('images/map RPG3.tmx')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/util_pygame.py", line 116, in load_pygame
return pytmx.TiledMap(filename, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py", line 285, in init
self.parse_xml(ElementTree.parse(self.filename).getroot())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py", line 319, in parse_xml
self.add_layer(TiledImageLayer(self, subnode))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py", line 1110, in init
self.parse_xml(node)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytmx/pytmx.py", line 1129, in parse_xml
self.source = image_node.get('source')
AttributeError: 'NoneType' object has no attribute 'get'
code
There is my code:
import pygame
import pytmx
pygame.init()
display_width = 800
display_height = 800
white = (255, 255, 255)
gameScreen = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('2d Game')
clock = pygame.time.Clock()
gameMap = pytmx.load_pygame('images/map RPG3.tmx')
def game_loop():
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
for layer in gameMap.visible_layers:
for x, y, gid, in layer:
tile = gameMap.get_tile_image_by_gid(gid)
gameScreen.blit(tile, (x * gameMap.tilewidth,
y * gameMap.tileheight))
pygame.display.update()
clock.tick(30)
game_loop()
pygame.quit()
The code did not really matter because I tried it with other codes and it would give the same error.
Please help me.
The text was updated successfully, but these errors were encountered: