Answer the question
In order to leave comments, you need to log in
Error when connecting SMBConnection to remote servers, please help me understand what is the error?
I made an application for synchronizing revoked servificato between servers, when it comes to copying, the application crashes with an error, maybe I don’t understand the workflow in my case, maybe someone can point me in the right direction?)
Error:
Traceback (most recent call last):
File "c:\users\november.31st\documents\visual studio 2017\Projects\CopyCRL\CopyCRL\CopyCRL.py", line 28, in <module>
copysrvmain = shutil.copytree(srcsrv+srcsrvpath, srv+dstpath)
File "C:\Users\November.31st\AppData\Local\Programs\Python\Python35-32\lib\shutil.py", line 303, in copytree
names = os.listdir(src)
FileNotFoundError: [WinError 3] The system cannot find the path specified: '127.0.0.1\\CRL'
import shutil, configparser
from smb.SMBConnection import SMBConnection
client_machine_name = 'QUIK_SYNC'
config = configparser.ConfigParser()
config.read('copycrl.ini')
usr = config.get('user', 'user')
usrpwd = config.get('user', 'pwd')
usrs = config.get('usersource', 'user')
usrpwds = config.get('usersource', 'pwd')
srcsrv = config.get('source', 'srv')
srcsrvpath = config.get('source', 'path')
dstpath = config.get('dst', 'path')
srv = config.get('servers', 'dstsrv')
connsrc = SMBConnection(usrs, usrpwds, client_machine_name, srcsrv, use_ntlm_v2=True, is_direct_tcp=True) #Обозначили коннекты SMB
conndst = SMBConnection(usr, usrpwd, client_machine_name, srv, use_ntlm_v2=True, is_direct_tcp=True)
connsrc.connect(srcsrv, 445) #Открываем конекты.
conndst.connect(srv, 445)
copysrvmain = shutil.copytree(srcsrv+srcsrvpath, srv+dstpath) #Копируем файлы из локальной папки на удаленный сервер
[user]
user = Broker
pwd = 111
[usersource]
user = Broker
pwd = 222
[source]
srv = 127.0.0.1
path = \CRL
[dst]
path = \CRL
[servers]
dstsrv = 192.168.150.120
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question