[issue22622] ElementTree only writes declaration when passed encoding

2020-05-17 Thread Stefan Behnel


Stefan Behnel  added the comment:

Right, thanks. Closing since this works in Py3.

--
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22622] ElementTree only writes declaration when passed encoding

2020-05-17 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL, so I think this issue should be closed.

--
nosy: +ZackerySpytz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22622] ElementTree only writes declaration when passed encoding

2015-09-09 Thread Martin Panter

Martin Panter added the comment:

As far as I can tell this was already working, even in 3.4.0a1 (the first 
pre-release of 3.4):

>>> tree.write('/dev/stdout', xml_declaration=True)



But it is not working in Python 2:

>>> tree.write('/dev/stdout', xml_declaration=True)


Looking at the history, I am confused because a 3.2.3 revision (df8609f1854d) 
comes up in the history of 2.7’s /Doc/library/xml.etree.elementtree.rst. 
Perhaps it is just that the documentation has inherited some wording from 
Python 3. Possibly also relevant: revision 57e631f 
 and Issue 8047.

--
nosy: +martin.panter
stage:  -> needs patch
versions: +Python 2.7 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22622] ElementTree only writes declaration when passed encoding

2014-10-13 Thread Stefan Behnel

Changes by Stefan Behnel :


--
nosy: +eli.bendersky, scoder

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22622] ElementTree only writes declaration when passed encoding

2014-10-13 Thread towb

New submission from towb:

This generates an XML declaration:

import xml.etree.ElementTree as ET

root = ET.Element('rss', version='2.0')
tree = ET.ElementTree(root)
tree.write('test.xml', encoding='iso-8859-1', xml_declaration=True)

However the declaration disappears if your don't pass an encoding. This doesn't 
match the documentation:

xml_declaration controls if an XML declaration should be added to the file. 
Use False for never, True for always, None for only if not US-ASCII or UTF-8 or 
Unicode (default is None).

--
components: Library (Lib)
messages: 229238
nosy: towb
priority: normal
severity: normal
status: open
title: ElementTree only writes declaration when passed encoding
type: behavior
versions: Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com