python - checking if a user has admin privileges

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-06-01T01:00:11Z Indexed on 2010/06/01 1:03 UTC
Read the original article Hit count: 271

Filed under:
|
|

Hi, I'm writing a little program as a self-learning project in Python 3.x. my idea is for the program to allow two fields of text entry to the user, and then plug the user's input into the value of two specific registry keys. What I was wondering, and something my books don't seem to cover, is if there is a simple way to make it check if the current user can access the registry. I'd rather it cleanly tell the user that he needs admin privileges than for the program to go nuts and crash because it's trying to access a restricted area. I'd like it to make this check as soon as the program launches, before the user is given any input options. What code is needed for this? thanks for the help

© Stack Overflow or respective owner

Related posts about python

Related posts about registry