def check_is_admin():
global _is_admin
if _is_admin is None:
from win32com.shell.shell import IsUserAnAdmin
import pythoncom
try:
_is_admin = IsUserAnAdmin()
except pythoncom.com_error, exc:
if exc.hresult != winerror.E_NOTIMPL:
raise
# not impl on this platform - must be old - assume is admin
_is_admin = True
return _is_admin
# If this exception is raised by a test, the test is reported as a 'skip'
评论列表
文章目录