Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Problem with xml2protobuf.py

Hi Tom,

the xml2protobuf seems to be designed only for certain protocol outputs
generated by sumo.
the test case for this scripts uses amitran trajectories.
You can not serialize any xml file.

Regards Harald

Am 06.02.19 um 09:12 schrieb cchadj01@xxxxxxxxxxxx:
> Hello Harald,
>
>  Thank you for the prompt respose.
>  I tried out your solution.
> py -2 /c/Program\ Files\
> \(x86\)/Eclipse/Sumo/tools/xml/xml2protobuf.py in-test.con.xml -x
> xsd/connections_file.xsd -o output
>
> I get this error:
>
> Traceback (most recent call last):
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 199, in <module>
>     main()
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 186, in main
>     attrFinder.xsdStruc._namedEnumerations, options.protodir, base)
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 165, in generateProto
>     writeField(protof, a.use, a.type, a.name, count)
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 145, in writeField
>     (use, getProtobufType(typ), name, tagNumber))
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 138, in
> getProtobufType
>     return capitalFirst(typ)
>   File "C:/Program Files
> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 39, in capitalFirst
>     return s[0].upper() + s[1:]
> IndexError: string index out of range
>
> Thank you,
> Tom
> Quoting Harald Schaefer <fechsaer@xxxxxxxxx>:
>
>> Hi Tom,
>>
>> your input file(in-test.con.xml) must match the xsd file.
>> It seems that your input file is a connection file and the tag
>> Connections is not found in the xsd file.
>> You might try the schema xsd/connections_file.xsd or use a xml-file
>> which validates against the schema xsd/netconvertConfiguration.xs.
>>
>> Regards, Harald
>>
>> Am 05.02.19 um 15:44 schrieb cchadj01@xxxxxxxxxxxx:
>>> Hello,
>>>
>>>  I am trying to use xml2protobuf.py
>>>  I am using git bash and I executed this command:
>>>
>>>  py -2 /c/Program\ Files\
>>> \(x86\)/Eclipse/Sumo/tools/xml/xml2protobuf.py in-test.con.xml -o out
>>> -x xsd/netconvertConfiguration.xsd
>>> I get these errors:
>>>
>>> Traceback (most recent call last):
>>>   File "C:/Program Files
>>> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 199, in <module>
>>>     main()
>>>   File "C:/Program Files
>>> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 195, in main
>>>     xml.sax.parse(options.source, handler)
>>>   File "C:\Python27\lib\xml\sax\__init__.py", line 33, in parse
>>>     parser.parse(source)
>>>   File "C:\Python27\lib\xml\sax\expatreader.py", line 110, in parse
>>>     xmlreader.IncrementalParser.parse(self, source)
>>>   File "C:\Python27\lib\xml\sax\xmlreader.py", line 123, in parse
>>>     self.feed(buffer)
>>>   File "C:\Python27\lib\xml\sax\expatreader.py", line 213, in feed
>>>     self._parser.Parse(data, isFinal)
>>>   File "C:\Python27\lib\xml\sax\expatreader.py", line 317, in
>>> start_element
>>>     self._cont_handler.startElement(name, AttributesImpl(attrs))
>>>   File "C:/Program Files
>>> (x86)/Eclipse/Sumo/tools/xml/xml2protobuf.py", line 67, in startElement
>>>     self.emptyRootMsg = vars(self.module)[capitalFirst(name)]()
>>> KeyError: u'Connections'
>>>
>>>  Notice that I use python 2.7 and I have installed google.protobuf
>>> module. I also copied xsd folder to my working directory.
>>>
>>>  Am I doing something wrong?
>>>
>>> Thank you,
>>> Tom
>>> _______________________________________________
>>> sumo-user mailing list
>>> sumo-user@xxxxxxxxxxx
>>> 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
>> sumo-user@xxxxxxxxxxx
>> 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
> sumo-user@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or
> unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user




Back to the top