diff --git a/openmc/settings.py b/openmc/settings.py
index 74ec0d54a6..3c1c8c7f5c 100644
--- a/openmc/settings.py
+++ b/openmc/settings.py
@@ -1598,6 +1598,7 @@ class Settings:
# Clean the indentation in the file to be user-readable
clean_indentation(element)
+ reorder_attributes(element) # TODO: Remove when support is Python 3.8+
return element
@@ -1618,7 +1619,6 @@ class Settings:
p /= 'settings.xml'
# Write the XML Tree to the settings.xml file
- reorder_attributes(root_element) # TODO: Remove when support is Python 3.8+
tree = ET.ElementTree(root_element)
tree.write(str(p), xml_declaration=True, encoding='utf-8')
diff --git a/openmc/tallies.py b/openmc/tallies.py
index e37f04e252..e17e7c99db 100644
--- a/openmc/tallies.py
+++ b/openmc/tallies.py
@@ -3166,6 +3166,7 @@ class Tallies(cv.CheckedList):
# Clean the indentation in the file to be user-readable
clean_indentation(element)
+ reorder_attributes(element) # TODO: Remove when support is Python 3.8+
return element
@@ -3187,7 +3188,6 @@ class Tallies(cv.CheckedList):
p /= 'tallies.xml'
# Write the XML Tree to the tallies.xml file
- reorder_attributes(root_element) # TODO: Remove when support is Python 3.8+
tree = ET.ElementTree(root_element)
tree.write(str(p), xml_declaration=True, encoding='utf-8')
diff --git a/tests/regression_tests/model_xml/photon_production_inputs_true.dat b/tests/regression_tests/model_xml/photon_production_inputs_true.dat
index e4fe9a5858..0b2b434681 100644
--- a/tests/regression_tests/model_xml/photon_production_inputs_true.dat
+++ b/tests/regression_tests/model_xml/photon_production_inputs_true.dat
@@ -23,7 +23,7 @@
0 0 0
-
+
14000000.0 1.0