On Windows Vista/7, with UAC, administrator accounts run programs in unprivileged mode by default.
Programs must prompt for administrator access before they run as administrator, with the ever-so-familiar UAC dialog. Since Python scripts aren't directly executable, there's no "Run as Administrator" context menu option.
It's possible to use ctypes.windll.shell32.IsUserAnAdmin()
to detect whether the script has admin access, and ShellExecuteEx
with the 'runas' verb on python.exe, with sys.argv[0] as a parameter to prompt the UAC dialog if needed.