1

I am working on a program that mounts a windows shared network drive using quickly. So I sat up my GUI and everything.. But I don't know any python commands that mount a network place.. Usually when I use the Linux script I use this command

gvfs-mount smb://192.168.2.25/"Extended (D)"

but of course this won't work with python.. So can anyone help me or give me the command to try to mount a specific network place?

3
  • 2
    why not just import os; os.system("gvfs-mount smb://192.168.2.25/\"Extended (D)\"");? Nov 24 '12 at 20:10
  • @Ysangkok thank you so much!! It worked.. Now I only need to finalize it and I will be done Nov 24 '12 at 20:52
  • No no no no! Not again with the os.system "solutions"! We have GIO for a reason: developer.gnome.org/gio/stable
    – Timo
    Nov 25 '12 at 11:50
2

You should have a look at GIO which will do the trick. Especially the GMountOperation and GVolume.

There's a working answer on SO which handles your issue.

2
  • Yeah I will try various commands and functions to make it mountable .. Although I am thinking of expanding it to accept a user Input for example 192.168.0.1/C and when the user hit the mount button.. It will mount the drive.. Any idea if I can do this? Nov 25 '12 at 20:45
  • 1
    Just use a Gtk.Entry and its get_text() method to get the user input.
    – Timo
    Nov 25 '12 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.