Hi,
when you look at the last line, it tells you “unclosed token”. This indicates 
that in the xml that you’re trying to parse, you’re missing an ending tag.
I am guessing you’re parsing a netstate-dump, which hasn’t finished the full 
simulation. 
To fix this: 
1. open the xml file (with a text editor)
2. check that ALL the tags that were opened somewhere have an ending tag 
further down. (e.g. for “netstate”, there should be a <netstate> somewhere in 
the beginning, and a </netstate> somewhere near the end; watch out for the 
nesting of the xml tags (check this: 
https://sumo.dlr.de/wiki/Simulation/Output/RawDump 
<https://sumo.dlr.de/wiki/Simulation/Output/RawDump>)).
3. add ending tags where necessary, save the xml in the editor.
4. run xml2csv.py again on the corrected xml.

I am guessing in your case, you’re just missing the last one.

Cheers,

Lukas

> On 25 Apr 2019, at 06:34, aditya medury <[email protected]> wrote:
> 
> Hi,
> 
> I am trying to convert the xml files obtained from netstate-dump and 
> fcd-output to csv using the python script "xml2csv.py" 
> (https://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py 
> <https://sumo.dlr.de/wiki/Tools/Xml#xml2csv.py>). However, I get an error for 
> both files which goes as follows:
> 
> ------
>  File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/expatreader.py", 
> line 217, in feed
>     self._parser.Parse(data, isFinal)
> xml.parsers.expat.ExpatError: unclosed token: line 938516, column 8
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/share/sumo/tools/xml/xml2csv.py", line 275, in <module>
>     main()
>   File "/usr/share/sumo/tools/xml/xml2csv.py", line 262, in main
>     attrFinder = AttrFinder(options.xsd, options.source, options.split)
>   File "/usr/share/sumo/tools/xml/xml2csv.py", line 82, in __init__
>     xml.sax.parse(source, self)
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/__init__.py", 
> line 33, in parse
>     parser.parse(source)
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/expatreader.py", 
> line 111, in parse
>     xmlreader.IncrementalParser.parse(self, source)
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/xmlreader.py", 
> line 127, in parse
>     self.close()
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/expatreader.py", 
> line 240, in close
>     self.feed("", isFinal = 1)
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/expatreader.py", 
> line 221, in feed
>     self._err_handler.fatalError(exc)
>   File 
> "/home/amedury/anaconda3/envs/tracking/lib/python3.6/xml/sax/handler.py", 
> line 38, in fatalError
>     raise exception
> xml.sax._exceptions.SAXParseException: netstate_dump.xml:938516:8: unclosed 
> token
> ---------
> 
> I was wondering if someone can suggest potential debugging options and/or 
> alternatives to store the output from SUMO as csv directly. The wiki mentions 
> that the script can listen in to incoming connections and facilitate writing 
> files to csv directly, but I was not able to understand the instructions very 
> well.
> 
> Any help would be much appreciated.
> 
> Thanks!
> 
> Aditya
> 
> 
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to