AttributeError: module 'ctypes.wintypes' has no attribute 'create_unicode_buffer'
<p>This is a part of my code:</p>

<pre><code>import os

def _get_appdata_path():
    import ctypes
    from ctypes import wintypes, windll
    CSIDL_APPDATA = 26
    _SHGetFolderPath = windll.shell32.SHGetFolderPathW
    _SHGetFolderPath.argtypes = [wintypes.HWND,
                                 ctypes.c_int,
                                 wintypes.HANDLE,
                                 wintypes.DWORD,
                                 wintypes.LPCWSTR]
    path_buf = wintypes.create_unicode_buffer(wintypes.MAX_PATH)
    result = _SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf)
    return path_buf.value
</code></pre>

<p>But when I call <code>wintypes.create_unicode_buffer()</code> I get the error:</p>

<pre><code>AttributeError: module 'ctypes.wintypes' has no attribute 'create_unicode_buffer'
</code></pre>

<p>I am using Python 3.5.1. What could I do?</p>

<p>Use ctypes.create_unicode_buffer, which works in both PY2 and PY3. It was only accidentally in wintypes in PY2 due to its use of <code>from ctypes import *</code>. :D</p>

python compiler-errors ctypes python-3.5