Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 669218

Summary: sci-geosciences/josm with dev-lang/python-3.7 - argument must be str, not bytes in ElementTree
Product: Gentoo Linux Reporter: Helmut Jarausch <jarausch>
Component: Current packagesAssignee: Sci-geo Project <sci-geosciences>
Status: RESOLVED FIXED    
Severity: normal CC: sci-geosciences
Priority: Normal Keywords: PMASKED
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: file build.xml

Description Helmut Jarausch 2018-10-21 16:48:25 UTC
Created attachment 552148 [details]
file build.xml

Hi,
I hope someone can help locating the following bug - at least, the error message
isn't very helpful

The following script is an excerpt of build-xml-rewrite ;
the file build.xml is attached

#!/usr/bin/python
import xml.etree.cElementTree as et
tree= et.ElementTree(file='build.xml')
gcp_str='${gentoo.classpath}'
gcp_sub= et.Element('classpath', path=gcp_str)
changes= [(['javadoc', 'javac', 'xjavac', 'javac.preset'], 'source', '1.8'), 
(['javac', 'xjavac', 'javac.preset'], 'target','1.8')]
for c in changes:
    elems, attr, value = c
    for elem in elems:
        for e in tree.getiterator(elem):
            e.attrib[attr] = value

with open('build_new.xml', 'w') as f:
   tree.write(f)


This gives

# Traceback (most recent call last):
#   File "Test.py", line 16, in <module>
#     tree.write(f)
#   File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 777, in write
#     short_empty_elements=short_empty_elements)
#   File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
#     next(self.gen)
#   File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 836, in _get_writer
#     yield file.write
#   File "/usr/lib/python3.7/contextlib.py", line 511, in __exit__
#     raise exc_details[1]
#   File "/usr/lib/python3.7/contextlib.py", line 496, in __exit__
#     if cb(*exc_details):
#   File "/usr/lib/python3.7/contextlib.py", line 383, in _exit_wrapper
#     callback(*args, **kwds)
# TypeError: write() argument must be str, not bytes


Many thanks for your help.
P.S.  this break emerge sci-geosciences/josm
Comment 1 Henning Schild 2021-08-04 17:49:02 UTC
Note that "sci-geosciences/josm-bin" was recently added as a new package. Switching to it might just solve this one for some people, while others might not like -bin. Give it a try and maybe rant on -bin.
Comment 2 Larry the Git Cow gentoo-dev 2021-12-13 16:36:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e482ee2190800320d2c7495c74c5d648e95dcd6c

commit e482ee2190800320d2c7495c74c5d648e95dcd6c
Author:     Jakov Smolić <jsmolic@gentoo.org>
AuthorDate: 2021-12-13 16:32:26 +0000
Commit:     Jakov Smolić <jsmolic@gentoo.org>
CommitDate: 2021-12-13 16:32:26 +0000

    sci-geosciences/josm: treeclean
    
    Closes: https://bugs.gentoo.org/819129
    Closes: https://bugs.gentoo.org/669218
    Closes: https://bugs.gentoo.org/717274
    Closes: https://bugs.gentoo.org/622502
    Closes: https://bugs.gentoo.org/810712
    Signed-off-by: Jakov Smolić <jsmolic@gentoo.org>

 profiles/package.mask                  |  6 ---
 sci-geosciences/josm/Manifest          |  1 -
 sci-geosciences/josm/josm-10966.ebuild | 68 ----------------------------------
 sci-geosciences/josm/josm-99999.ebuild | 50 -------------------------
 sci-geosciences/josm/metadata.xml      |  8 ----
 5 files changed, 133 deletions(-)