Python Forum
use win32wnet to connect shared networks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
use win32wnet to connect shared networks
#1
Hi guys,

Using windows, I am trying to use win32wnet module to connect a shared network through a .py file. However, I am not being able to make it work. Has someone used that module to connect shared networks successfully and can point me out on how to do it?
The line not working is the one below the try statement.
Many thanks in advance,

Joan

import os
import win32netcon
import win32wnet


ynetworkPath = '\\\\LAMPSERVER_RB\\resources_server\\'
znetworkPath = '\\\\LAMPSERVER\\lampserver\\_PROJECTS\\'
yDrive = 'Y:'
user = 'a'
password = 'b'

if (os.path.exists(ynetworkPath)):
    try:
        win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, yDrive, ynetworkPath, None, user, password, 0)
        print "connection working"
    except:
        print "Not working"

else:
    print "path not existing"


C:\Python27\python.exe D:/pipeline/development/testing_for_network_link.py
Not working

Process finished with exit code 0
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I was trying to build a model using neural networks but It says layers not definied MohammedSohail 6 10,908 Jun-09-2020, 01:14 PM
Last Post: MohammedSohail
  Shared queues l00p1n6 3 3,751 May-15-2018, 01:38 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020