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
  Shared reference of variables... Denial 1 1,408 Aug-29-2020, 01:52 PM
Last Post: snippsat
  How to install and use a shared libary, via a .dll? ninjaisfast 0 1,293 Jul-09-2020, 03:23 PM
Last Post: ninjaisfast
  I was trying to build a model using neural networks but It says layers not definied MohammedSohail 6 7,848 Jun-09-2020, 01:14 PM
Last Post: MohammedSohail
  Divisors shared the second numbers mircea_dragu 1 2,037 Feb-07-2019, 10:09 PM
Last Post: ichabod801
  running just one process shared among uses Skaperen 3 2,981 Aug-07-2018, 12:12 AM
Last Post: Skaperen
  Shared reference and equality zyo 3 3,150 Jun-30-2018, 07:10 PM
Last Post: ljmetzger
  Shared queues l00p1n6 3 2,979 May-15-2018, 01:38 PM
Last Post: DeaD_EyE
  two different objects, but somehow the values are shared between them RaphaelMG 6 4,104 Apr-20-2018, 05:53 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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