2

In my Python GUI application, I have to run a command as root to perform a certain action (to be specific, it installs a Python module system-wide). On Linux I simply use gksudo or kdesu prefixed to the command passed to subprocess.Popen(). There doesn't seem to be a Mac equivalent, unfortunately. I have seen this question before pointing to some complicated Objective-C code called BetterAuthorizationSample... I don't really understand it and would prefer to not write Objective-C code to do this simple task. If there's a simpler way, I'd like to know. I'm thinking I could make my own password dialog box and pass it to regular command-line sudo on stdin.

Luke McCarthy
  • 879
  • 2
  • 9
  • 21
  • N.B. `sudo` might not simply use stdin. Have a read of this: http://www.noah.org/wiki/Pexpect#Q:_Why_not_just_use_a_pipe_.28popen.28.29.29.3F – Thomas K Oct 10 '11 at 16:29

0 Answers0