Error in mapping a NFS drive in windows using "net use"

This is the place for queries that don't fit in any of the other categories.

Error in mapping a NFS drive in windows using "net use"

Postby asuyal » Thu Aug 15, 2013 4:44 pm

Hi,

I am new to python, and stuck with a issue with mapping network drives in windows. Any help will be much appreciated.

Here is the code snippet I am using:
Code: Select all
import os,subprocess
mount_nfs_command = 'net use P:'+' '+os.sep+os.sep+NFS_IP+os.sep+NFS_SHARENAME+' /PERSISTENT:NO'
p = subprocess.Popen(tmp_bat_file, stdout=subprocess.PIPE,stdin=subprocess.PIPE,shell=True)
output = p.stdout.read()


Here NFS_IP=IP address of NFS share, NFS_SHARENAME=Name of share

When I run this script, I get following error:
Code: Select all
"System error 67 has occurred. \
The network name cannot be found."


However, when I run the same command from windows shell, it works fine. (I have Windows NFS role enabled,and NFS share does not have any username or password)

I have tried using os.system() also, but with no success. Also, tried to change the path as shown below:
Code: Select all
mount_nfs_command = 'net use P:'+' '+os.sep+os.sep+os.sep+os.sep+NFS_IP+os.sep+os.sep+NFS_SHARENAME+' /PERSISTENT:NO'
OR
Code: Select all
mount_nfs_command = 'net use P:'+' '+'\\\\'+NFS_IP+'\\'+NFS_SHARENAME+' /PERSISTENT:NO'

But this also did not help.

Any help from the experts here is much appreciated.

Thanks !
Last edited by Yoriz on Thu Aug 15, 2013 4:51 pm, edited 1 time in total.
Reason: Added code tags
asuyal
 
Posts: 1
Joined: Thu Aug 15, 2013 4:33 pm

Re: Error in mapping a NFS drive in windows using "net use"

Postby Yoriz » Thu Aug 15, 2013 4:52 pm

Hi, welcome to the forum.
Please read the 'new user read this' link in my signature.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 832
Joined: Fri Feb 08, 2013 1:35 am
Location: UK


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 2 guests