擅长:python、mysql、java
<p>您可以在/Volumes处检查装载路径,如下所示:</p>
<pre><code>mountedpath = os.path.join("/Volumes", local_dir)
if not os.path.exists(mountedpath):
retcode = subprocess.call(["/sbin/mount", "-t", "smbfs", remote_dir, local_dir])
if retcode != 0:
raise OSError("Mount operation failed")
else:
print "Mounted path found"
</code></pre>