diff --git a/pyzebra/anatric.py b/pyzebra/anatric.py index 5a8c7d8..d358109 100644 --- a/pyzebra/anatric.py +++ b/pyzebra/anatric.py @@ -59,6 +59,9 @@ class AnatricConfig: def save_as(self, filename): self._tree.write(filename) + def tostring(self): + return ET.tostring(self._tree.getroot(), encoding="unicode") + def _get_attr(self, name, tag, attr): elem = self._tree.find(name).find(tag) if elem is None: diff --git a/pyzebra/app/panel_hdf_anatric.py b/pyzebra/app/panel_hdf_anatric.py index e71a4ca..b796b5a 100644 --- a/pyzebra/app/panel_hdf_anatric.py +++ b/pyzebra/app/panel_hdf_anatric.py @@ -389,11 +389,7 @@ def create(): ) async def update_config(): - with tempfile.TemporaryDirectory() as temp_dir: - temp_file = temp_dir + "/config.xml" - config.save_as(temp_file) - with open(temp_file) as f_config: - output_config.value = f_config.read() + output_config.value = config.tostring() doc.add_periodic_callback(update_config, 1000)