petervizi / python-eeml

A python package for generating eeml documents.
http://petervizi.github.com/python-eeml
GNU General Public License v3.0
43 stars 11 forks source link

CosmError: XML Parser Error: Duplicate datastream ids #23

Closed jolcese closed 11 years ago

jolcese commented 11 years ago

I'm looping between a pac.update and almost 1 out of 2 pac.put() will fail with this error: CosmError: XML Parser Error: Duplicate datastream ids

I can see on the cosm debug a successfull push: <eeml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns="http://www.eeml.org/xsd/0.5.1&quot; xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd&quot; version="0.5.1"><environment><data id="1"><current_value>1161.71</current_value><unit type="derivedSI" symbol="W">Watt</unit></data><data id="3"><current_value>1187.12</current_value><unit type="derivedSI" symbol="VA">VoltAmpere</unit></data><data id="2"><current_value>464.41</current_value><unit type="derivedSI" symbol="kWh">WattHour</unit></data><data id="0"><current_value>5183.06</current_value><unit type="basicSI" symbol="mA">Ampere</unit></data><data id="5"><current_value>229.04</current_value><unit type="derivedSI" symbol="V">Volt</unit></data><data id="4"><current_value>0.97</current_value></data></environment></eeml>

But the following push fails with 400: <eeml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns="http://www.eeml.org/xsd/0.5.1&quot; xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd&quot; version="0.5.1"><environment><data id="1"><current_value>1161.71</current_value><unit type="derivedSI" symbol="W">Watt</unit></data><data id="3"><current_value>1187.12</current_value><unit type="derivedSI" symbol="VA">VoltAmpere</unit></data><data id="2"><current_value>464.41</current_value><unit type="derivedSI" symbol="kWh">WattHour</unit></data><data id="0"><current_value>5183.06</current_value><unit type="basicSI" symbol="mA">Ampere</unit></data><data id="5"><current_value>229.04</current_value><unit type="derivedSI" symbol="V">Volt</unit></data><data id="4"><current_value>0.97</current_value></data><data id="1"><current_value>1182.68</current_value><unit type="derivedSI" symbol="W">Watt</unit></data><data id="3"><current_value>1213.19</current_value><unit type="derivedSI" symbol="VA">VoltAmpere</unit></data><data id="2"><current_value>464.41</current_value><unit type="derivedSI" symbol="kWh">WattHour</unit></data><data id="0"><current_value>5301.12</current_value><unit type="basicSI" symbol="mA">Ampere</unit></data><data id="5"><current_value>228.85</current_value><unit type="derivedSI" symbol="V">Volt</unit></data><data id="4"><current_value>0.97</current_value></data></environment></eeml>

This is because dapoints from previous version are also included.

petervizi commented 11 years ago

Hi jolcese,

Thanks for reporting this. The issue comes from the fact that Data objects are stored in a list and an update only appends to that. It's quite trivial to change the data structure to a map, keyed by Data's id. Will keep you posted.

jolcese commented 11 years ago

Hi Peter, Thanks a lot for looking into this. BTW, really great work! Jose

J+

On Thu, Jan 31, 2013 at 8:51 AM, Peter Vizi notifications@github.comwrote:

Hi jolcese,

Thanks for reporting this. The issue comes from the fact that Data objects are stored in a list and an update only appends to that. It's quite trivial to change the data structure to a map, keyed by Data's id. Will keep you posted.

— Reply to this email directly or view it on GitHubhttps://github.com/petervizi/python-eeml/issues/23#issuecomment-12939090.