PySMB处理程序-[WinError 10054]现有连接被远程主机强行关闭

时间:2018-07-09 12:22:51

标签: python python-3.x smb

我正准备使用PYSMB smb处理程序将文件从Linux框中保存到Windows共享文件夹中。目前,我正在Windows框上运行代码进行测试。

# -*- coding: utf-8 -*-
import urllib.request
from smb.SMBHandler import SMBHandler
director = urllib.request.build_opener(SMBHandler)
fh = director.open('smb://username:password!@Directory/path/upload_file.txt')
fh.close()

下面是显示的错误部分。

  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 526, in open
    response = self._open(req, data)

  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 544, in _open
    '_open', req)

  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)

  File "C:\ProgramData\Anaconda3\lib\site-packages\smb\SMBHandler.py", line 45, in smb_open
    names = n.queryIPForName(host)

  File "C:\ProgramData\Anaconda3\lib\site-packages\nmb\NetBIOS.py", line 79, in queryIPForName
    ret = self._pollForQueryPacket(trn_id, timeout)

  File "C:\ProgramData\Anaconda3\lib\site-packages\nmb\NetBIOS.py", line 144, in _pollForQueryPacket
    raise ex

  File "C:\ProgramData\Anaconda3\lib\site-packages\nmb\NetBIOS.py", line 131, in _pollForQueryPacket
    data, _ = self.sock.recvfrom(0xFFFF)

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

尽管有许多有关该错误的解决方案,但是smb处理程序没有特定的东西。您能帮我解决问题吗?

谢谢。

0 个答案:

没有答案