Greetings, One of my Python scripts basically does the following:
source = tarfile.open(name=tar_archive , mode='r|*') dest = tarfile.open(fileobj=sys.stdout, mode='w|', format=fmt) . . . source.close() dest.close() In an attempt to move my Python scripts from Python 2.7 to Python 3.6 I ran into the problem that under Python 3.6 the call to "dest.close()" fails: Traceback (most recent call last): File ".../tar_archive.copy", line 137, in <module> dest.close() File "/usr/lib64/python3.6/tarfile.py", line 1742, in close self.fileobj.close() File "/usr/lib64/python3.6/tarfile.py", line 467, in close self.fileobj.write(self.buf) TypeError: write() argument must be str, not bytes What am I doing wrong? By the way: since on some hosts this script is running on the transition from Python 2.7 to Python 3.x will not happen immediately, I need a solution which works with both versions. Sincerely, Rainer -- https://mail.python.org/mailman/listinfo/python-list