From: Adam Tauno Williams on
On Mon, 2010-05-17 at 17:54 +0200, Samuel Bancal wrote:
> Hi,
> I'm coding a script that does some automates for my users ...
> including mounting a smb share.
> Because we are using Gnome, I choosed to use gvfs-mount, which is
> quite similar to "Places > Connect to Server > ..."=
> Now my script does :
> print "*** Mounting the FILER ..."
> cmd = "/usr/bin/gvfs-mount smb://%s\;%
> s(a)" % (my_domain, my_user_name, my_user_name)
> try:
> retCode =, shell=True)
> except KeyboardInterrupt, e:
> sys.stderr.write("Interrupted by ctrl-c. Exiting\n")
> sys.exit(1)
> if retCode != 0:
> sys.stderr.write("Error while mounting : %s\n" % retCode
> I have two major problems with this code :
> - In case of "ctr-c" while the password is asked to the user, I get a
> Terminal in which the output from keyboard is inhibited... (like while
> typing password)
> - When the user runs this script by "double-click > Run" (not "Run in
> terminal") ... there is no interaction with the user.

Which is normal [there is a run-in-terminal check box somewhere?]. If
your users are running it in GNOME then you should implement a GUI
(PyGTK) for the user interaction [prompting for the password]. Or
better use the GNOME keyring.


Adam Tauno Williams <awilliam(a)> LPIC-1, Novell CLA
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba