From cab2c71349361166a16408befac6b2b3b743c50a Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Fri, 6 Jun 2014 19:45:18 +0100 Subject: [archive] Use OSError instead of PermissionError The PermissionError exception is a python3 feature. Instead catch the OSError (from which it inherits) to work on both py2 and py3 runtimes. Related: #164 Signed-off-by: Bryn M. Reeves --- sos/archive.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sos/archive.py b/sos/archive.py index 9df3782a..caf621e7 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -144,7 +144,7 @@ class FileCacheArchive(Archive): self.log_debug("caught '%s' copying '%s'" % (e, src)) try: shutil.copystat(src, dest) - except PermissionError: + except OSError: # SELinux xattrs in /proc and /sys throw this pass try: @@ -164,7 +164,7 @@ class FileCacheArchive(Archive): if os.path.exists(src): try: shutil.copystat(src, dest) - except PermissionError: + except OSError: pass self.log_debug("added string at '%s' to FileCacheArchive '%s'" % (src, self._archive_root)) @@ -260,7 +260,7 @@ class TarFileArchive(FileCacheArchive): def _build_archive(self): tar = tarfile.open(self._archive_name, mode="w") - # We need to pass the absolute path to the archive root but we + # we need to pass the absolute path to the archive root but we # want the names used in the archive to be relative. tar.add(self._archive_root, arcname=os.path.split(self._name)[1], filter=self.copy_permissions_filter) -- cgit