subprocess and gvfs-mount

Samuel Bancal sam.bancal at gmail.com
Mon May 17 11:54:38 EDT 2010


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@myfiler.domain.ch/data/%s" %
(my_domain, my_user_name, my_user_name)
        try:
            retCode = subprocess.call(cmd, 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.

I also did some try with subprocess.Popen ... with no success yet...

Thanks for any comment or suggestion!

Regards,
Samuel Bancal

ps : Or anyone knows how to get that gvfs-mount in GUI mode... Could see
nautilus-connect-server ... but couldn't find any options.

-- 
Samuel Bancal - CH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100517/4846d649/attachment.html>


More information about the Python-list mailing list