WinError 1326 the Username or password is incorrect

Viewed 561

I am trying to display files in a folder using this code:

import subprocess
import os

subprocess.call(r'net use \\\\192.168.50.11\c$\Folder_Name\ /user:vicky password:pass123', shell=True) #connect with network drive

print('Connection Established')

x = os.listdir('\\\\192.168.50.11\\c$\\Folder_Name')  #display the name of the files in directory

print(x)

But getting error as:

WinError 1326 the Username or password is incorrect:\\\\192.168.50.11\\c$\\Folder_Name

How can I solve this problem?

1 Answers

You have to execute the command like:

subprocess.call(r'net use \\\\192.168.50.11\c$\Folder_Name\ /user:vicky pass123', shell=True) #connect with network drive
x = os.listdir('\\\\192.168.50.11\\c$\\Folder_Name')  #display the name of the files in directory
print(x)

You have to remove the word "password" from the command

Related