kam*_*ame 1 python ctypes compiler-errors python-3.5
这是我的代码的一部分:
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
Run Code Online (Sandbox Code Playgroud)
但是当我打电话时,wintypes.create_unicode_buffer()
我得到了错误:
AttributeError: module 'ctypes.wintypes' has no attribute 'create_unicode_buffer'
Run Code Online (Sandbox Code Playgroud)
我使用的是Python 3.5.1.我能做什么?
使用ctypes.create_unicode_buffer,它在PY2和PY3中都有效.由于它的使用,它只是意外地在PY2中的wintypes from ctypes import *
.:d
归档时间: |
|
查看次数: |
1732 次 |
最近记录: |