title: write file to usb with python on linux
body: <p>I apologise if the question is so stupid but I am new in linux and python. 
  The point is that I need to write a python script which will detect connected usb stick and write a file to it. I use opensuse(but script shoild work with any linux distro. in ideal case). Current version can detect usb and write a file if that usb is mounted. But on my machine usb is mounted only if I browse it in file manager. Until that usb detected as a partion but without mount point. So, how can I force the system to mount usb or how can I write a file using devname or devpath or another information what I can get from hal manager. I can not use "mount" command because it requires a root permission</p>
  
  <p>Simplified Source code:</p>
  
  <pre><code>import dbus, gobject, os
  
  class DeviceAddedListener:
      def __init__(self):
          self.bus = dbus.SystemBus()
          self.hal_manager_obj = self.bus.get_object( "org.freedesktop.Hal", "/org/freedesktop/Hal/Manager")
          self.hal_manager = dbus.Interface(self.hal_manager_obj, "org.freedesktop.Hal.Manager")
          self.hal_manager.connect_to_signal("DeviceAdded", self.added)
  
      def show(self, name, udi):
          d_object = self.bus.get_object('org.freedesktop.Hal', udi)
          d_interface = dbus.Interface(d_object,'org.freedesktop.Hal.Device')
  
          if d_interface.QueryCapability("volume"):
              print name
              props = [ "block.device", "volume.label",  "volume.is_mounted", "volume.mount_point", "volume.size"]
              for p in props:
                  print '\t', p, " = ",
                  try:
                      print d_interface.GetProperty(p)
                  except:
                      print "Fail"
  
      def added(self, udi): 
          self.show("DeviceAdded", udi)
          self.bus.add_signal_receiver(self.property_modified,
              "PropertyModified",
              "org.freedesktop.Hal.Device", 
              "org.freedesktop.Hal",
              udi,
              path_keyword = "sending_device" )
  
      def property_modified(self, numupdates, updates, sending_device = None): 
          self.show("PropertyModified", sending_device) 
  
  
  
  if __name__ == '__main__':
      from dbus.mainloop.glib import DBusGMainLoop
      DBusGMainLoop(set_as_default=True)
      loop = gobject.MainLoop()
      DeviceAddedListener()
      print "running"
      loop.run()
  </code></pre>
  
  <p>The output when usb plugged in</p>
  
  <pre><code>DeviceAdded
  block.device  =  /dev/sdb1
  volume.label  =  @
  volume.is_mounted  =  0
  volume.mount_point  =  
  volume.size  =  4009722368
  </code></pre>
  
  <p>The output when usb plugged in and mounted</p>
  
  <pre><code>    block.device  =  /dev/sdb1
  volume.label  =  @
  volume.is_mounted  =  1
  volume.mount_point  =  /media/@
  volume.size  =  4009722368
  </code></pre>
  
  <p>Thanks for any help!</p>