 <p>The second parameter of SetFileAttributesW should be a code to set the value</p> <p>Try this</p> <pre><code>HIDE_ATTRIBUTE = 0x02 filepath='file path' ctypes.windll.kernel32.SetFileAttributesW(unicode(file2path), HIDE_ATTRIBUTE) </code></pre>