--On Tuesday, January 23, 2018 7:14 AM -0800 Kenneth Porter
<sh...@sewingwitch.com> wrote:
File "/usr/lib64/python2.7/site-packages/svn/fs.py", line 87, in
_dump_contents
fp.write(chunk)
TypeError: must be unicode, not str
Here's the code where this is going wrong. I think svn_stream_read is
returning a byte stream and the file object here is expecting a unicode
string. Is there a missing decode('utf-8') call? (I'm a very new Python
coder but have lots of experience in C++ and some understanding of unicode.)
Package is subversion-python-1.7.14-11.el7_4.x86_64 in CentOS 7.4.
From /usr/lib64/python2.7/site-packages/svn/fs.py
def _dump_contents(self, file, root, path, pool=None):
fp = builtins.open(file, 'w+') # avoid namespace clash with
# trimmed-down svn_fs_open()
if path is not None:
stream = file_contents(root, path, pool)
try:
while True:
chunk = _svncore.svn_stream_read(stream,
_svncore.SVN_STREAM_CHUNK_SIZE)
if not chunk:
break
fp.write(chunk)
finally:
_svncore.svn_stream_close(stream)
fp.close()
BTW, I found this nice treatment of unicode in Python 2 and 3:
<https://nedbatchelder.com/text/unipain.html>