title: Mount OS X volume only if it is not only mounted - how?
body: <p>I'm using a Python script to mount OS X volumes. How can I prevent getting an error whenever the volume has already been mounted (and so the script fails to mount to the local directory)?</p>
  
  <pre><code>def volumeMounter(remote_dir, local_dir):
      # Create local dir if it does not exist
      if not os.path.exists( local_dir ):
          os.makedirs( local_dir )
      local_dir = os.path.abspath(local_dir)
  
      # Attempt mounting of server share
      retcode = subprocess.call(["/sbin/mount", "-t", "smbfs", remote_dir, local_dir])
      if retcode != 0:
          raise OSError("Mount operation failed")
  </code></pre>