pysmb icon indicating copy to clipboard operation
pysmb copied to clipboard

smb.base.NotConnectedError --Urgent

Open duanxhui opened this issue 3 years ago • 5 comments

conn = SMBConnection(username, password, '5CG1094TZH', 'cifstxsha', domain='jia.volvocars.net') print(conn) conn.connect('10.243.172.123', timeout=60) print(conn.auth_result)

Above is my code. and I got error below. Would you please help me to check? Traceback (most recent call last): File "Y:\Data\Desktop\11-spider\Battery mudule\Battery_analysis.py", line 50, in conn.connect('10.243.172.123', timeout=60) File "C:\Users\xduan3\AppData\Roaming\Python\Python39\site-packages\smb\SMBConnection.py", line 127, in connect self._pollForNetBIOSPacket(timeout) File "C:\Users\xduan3\AppData\Roaming\Python\Python39\site-packages\smb\SMBConnection.py", line 604, in _pollForNetBIOSPacket raise NotConnectedError smb.base.NotConnectedError

Process finished with exit code 1

duanxhui avatar Jul 05 '21 05:07 duanxhui

Can you drop the domain parameter and use: conn = SMBConnection(username, password, '5CG1094TZH', 'cifstxsha')

I'm assuming that you have verified that the SMB service "cifstxsha" is running on 10.243.172.123

miketeo avatar Jul 05 '21 13:07 miketeo

Can you drop the domain parameter and use: conn = SMBConnection(username, password, '5CG1094TZH', 'cifstxsha')

I'm assuming that you have verified that the SMB service "cifstxsha" is running on 10.243.172.123

Hi Miketeo,

Thanks for quick respinse. I have tried that. but anothe issue occured as below. I don't know whether is because the user and password has no priviledge to this nas but only to specific direcotory of this nas.

File "Y:/Data/Desktop/11-spider/Battery_mudule/Battery_analysis.py", line 34, in conn.connect('10.243.172.123', 445) File "C:\Users\xduan3\AppData\Local\Programs\Python\Python37\lib\site-packages\smb\SMBConnection.py", line 118, in connect self.sock = socket.create_connection(( ip, port )) File "C:\Users\xduan3\AppData\Local\Programs\Python\Python37\lib\socket.py", line 727, in create_connection raise err File "C:\Users\xduan3\AppData\Local\Programs\Python\Python37\lib\socket.py", line 716, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Process finished with exit code 1

duanxhui avatar Jul 07 '21 07:07 duanxhui

Can you drop the domain parameter and use: conn = SMBConnection(username, password, '5CG1094TZH', 'cifstxsha')

I'm assuming that you have verified that the SMB service "cifstxsha" is running on 10.243.172.123

It still doesn't work, I accidently close it and now reopen it again.

duanxhui avatar Jul 07 '21 07:07 duanxhui

When the SMBConnection is aborted like this, it usually means that the remote service is not listening on the port. Does the NAS appear on your Windows network?

miketeo avatar Jul 07 '21 13:07 miketeo

When the SMBConnection is aborted like this, it usually means that the remote service is not listening on the port. Does the NAS appear on your Windows network?

Sure, I can open it on my computer. It appears on my windows network

duanxhui avatar Jul 08 '21 01:07 duanxhui