importplatformimportctypesdefwindows_only(func):ifplatform.system()!='Windows':returnlambda*args,**kwargs:Nonereturnfunc@windows_onlydefhide_file(path):""" Set the hidden attribute on a file or directory. From http://stackoverflow.com/questions/19622133/ `path` must be text. """__import__('ctypes.wintypes')SetFileAttributes=ctypes.windll.kernel32.SetFileAttributesWSetFileAttributes.argtypes=ctypes.wintypes.LPWSTR,ctypes.wintypes.DWORDSetFileAttributes.restype=ctypes.wintypes.BOOLFILE_ATTRIBUTE_HIDDEN=0x02ret=SetFileAttributes(path,FILE_ATTRIBUTE_HIDDEN)ifnotret:raisectypes.WinError()