I need to stop GNOME/Nautilus from automagically mounting new devices and partitions as they appear to the system. How can I accomplish this in python?
Why would do it in Python? You can just use the commandline, as in:
gconftool-2 --type bool --set /apps/nautilus/preferences/media_automount false
If you really need it to be in Python, then you can use the subprocess module:
import subprocess
def setAutomount(value):
"""
@type value: boolean
"""
cmd = ['gconftool-2', '--type', 'bool', '--set',
'/apps/nautilus/preferences/media_automount']
cmd.append(str(value).lower())
subprocess.check_call(cmd)
setAutomount(False)
But I'm really not sure that it's necessary here.