Skip to content

Instantly share code, notes, and snippets.

@Pugio
Created November 15, 2011 14:32
Show Gist options
  • Save Pugio/1367211 to your computer and use it in GitHub Desktop.
Save Pugio/1367211 to your computer and use it in GitHub Desktop.
Python mount share
network_share_available = os.path.isdir(network_share_path)
if network_share_available:
logger.info("Share already connected.")
else:
logger.info("Connecting to share")
mount_command = "net use " + SHARE_PATH + " "
os.system(mount_command)
network_share_available = os.path.isdir(network_share_path)
if network_share_available:
logger.fine("Connection success.")
else:
raise Exception("Failed to find storage directory.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment