def chmod(self, tarinfo, targetpath):
if hasattr(os, '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>os.chmod(targetpath, tarinfo.mode)<EOL><DEDENT>except EnvironmentError as e:<EOL><INDENT>raise ExtractError("<STR_LIT>")<EOL><DEDENT><DEDENT>
Set file permissions of targetpath according to tarinfo.