Dj Gilcrease wrote:
I have a python app that requires elevated privileges on Vista when installed in "Program Files" since it has an auto updater. I was wondering if there was a way with a standard install of python 2.6 that I can check if I have the correct privileges and if not relaunch the app required privileges.
I never worked with UAC, but I think you can try writing to the Program Files/YourApp and if it fails and raises IOError (check the exception arguments as well) then you don't have the privilege. At least that what I *think* how Windows Explorer file copying routine works (based on day-to-day observation, not some special research, I'd love to be proven wrong).
You can also try using runas, though I never figured out how to make it work to obtain administrator privilege (sudo is much easier to work with): C:\Users\Lie Ryan>runas /user:"MyUserName" "C:\Python26\python.exe \"K:\path\to\my\script.py\""
That will run the script as user "MyUserName" though only with the standard privilege.
Alternatively, you may be able to dissect this script and include parts of it with your app:
http://bink.nu/news/script-elevation-powertoys-for-windows-vista.aspx _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
