0
DNS에 나열되지 않은 서버에 연결하려고합니다. 단지 ip가있는 서버입니다.파이썬에서 wnet_connect (호스트, 사용자 이름 = 없음, 암호 = 없음)를 사용합니다.
netpath = r'\\10.5.1.22\Products'
networkPath = netpath
unc = ''.join(['\\\\', host])
print unc
try:
win32wnet.WNetAddConnection2(0, None, unc, None, username, password)
except Exception, err:
if isinstance(err, win32wnet.error):
#Disconnect previous connections if detected, and reconnect.
if err[0] == 1219:
win32wnet.WNetCancelConnection2(unc, 0, 0)
return wnet_connect(host, username, password)
raise err
내가 서버 나 컴퓨터에 연결하는 파이썬 2.7