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


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 =

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'
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
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.
Due to the reasons discussed here we will be moving to on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 1672
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 7 guests