[macCreatorType] fix KeyError raised by old version of xattr module

in version 0.6.4 (installed on OS X 10.10 python lib/extras) it raises
KeyError, whereas in the latest version available fom PyPI (v0.7.8) it
raises IOError.

Fixes issue in https://github.com/googlei18n/nototools/issues/113
This commit is contained in:
Cosimo Lupo 2015-11-11 00:01:50 +00:00
parent 75d4805256
commit f10cb1f17d

View File

@ -21,7 +21,7 @@ def getMacCreatorAndType(path):
if xattr is not None:
try:
finderInfo = xattr.getxattr(path, 'com.apple.FinderInfo')
except IOError:
except (KeyError, IOError):
pass
else:
fileType = Tag(finderInfo[:4])