Skip to content

error in generate_xml #43

Description

@Crazy-Mage

code
xml_str = ET.tostring(annotation)
print(xml_str)
root = etree.fromstring(xml_str)
xml_str=etree.tostring(root, pretty_print=True)
save_path = os.path.join(savedir, img.name.replace('jpg','xml'))
with open(save_path,'wb') as temp_xml:
temp_xml.write(xml_str)
Error
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\cbook_init_.py", line 216, in process
func(*args, **kwargs)
File "make_annotation.py", line 31, in onkeypress
write_xml(image_folder, img, object_list, tl_list, br_list, savedir)
File "C:\VIT\SET\CODE\darkflow-master\new_model_data\generate_annotation.py", line 36, in write_xml
root = etree.fromstring(xml_str)
File "src\lxml\etree.pyx", line 3234, in lxml.etree.fromstring
File "src\lxml\parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src\lxml\parser.pxi", line 1764, in lxml.etree._parseDoc
File "src\lxml\parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc
File "src\lxml\parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src\lxml\parser.pxi", line 711, in lxml.etree._handleParseResult
File "src\lxml\parser.pxi", line 640, in lxml.etree._raiseParseError
File "", line 1
lxml.etree.XMLSyntaxError: StartTag: invalid element name, line 1, column 237
xml_str contains
b'imagesreal_00001.jpg06006003facesUnspecified0< difficult>0</ difficult>21598597'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions