Changeset 636


Ignore:
Timestamp:
08/09/10 11:15:02 (9 years ago)
Author:
beliar
Message:

Patch by Beliar

  • Fixed missing end tag in xml
  • Catching SyntaxError? Exception in getAgentImportFiles method of GameModel? and printing a message that contains the file and the error message.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gamemodel.py

    r632 r636  
    713713        for xml_file in files: 
    714714            xml_file = os.path.relpath(xml_file).replace("\\", "/") 
    715             root = ElementTree.parse(xml_file).getroot() 
    716             if root.tag == "object": 
    717                 self.agent_import_files[root.attrib["id"]] = xml_file 
     715            try: 
     716                root = ElementTree.parse(xml_file).getroot() 
     717                if root.tag == "object": 
     718                    self.agent_import_files[root.attrib["id"]] = xml_file 
     719            except SyntaxError as error: 
     720                assert(isinstance(error, SyntaxError)) 
     721                print "Error parsing file " + xml_file + ": " + error.msg 
     722                #TODO: We may want to make this an fatal error later. 
    718723     
    719724    def getDialogues(self): 
Note: See TracChangeset for help on using the changeset viewer.