os.path.exists() and Samba shares

Discussion in 'Python' started by BDZ, Jul 30, 2009.

  1. BDZ

    BDZ Guest

    Hello. I have written a Python 3.1 script running on Windows that uses
    os.path.exists() to connect to network shares. If the various network
    shares require different user account and password combos than the
    account the script is running under the routine returns false. I need
    something like os.samba.path.exists(username,password,path). Does
    anyone have a suggestion on how I can accomplish what I need to do in
    Python?
    BDZ, Jul 30, 2009
    #1
    1. Advertising

  2. Hi,

    > Hello. I have written a Python 3.1 script running on Windows that uses
    > os.path.exists() to connect to network shares. If the various network
    > shares require different user account and password combos than the
    > account the script is running under the routine returns false. I need
    > something like os.samba.path.exists(username,password,path). Does
    > anyone have a suggestion on how I can accomplish what I need to do in
    > Python?


    Could the Python Samba module PySamba be interesting for you?
    http://sourceforge.net/projects/pysamba/

    HTH,
    Loïc
    --
    My blog: http://www.domaigne.com/blog
    Loïc Domaigné, Jul 30, 2009
    #2
    1. Advertising

  3. BDZ

    BDZ Guest

    On Jul 30, 4:41 pm, Loïc Domaigné <>
    wrote:
    > Hi,
    >
    > > Hello. I have written a Python 3.1 script running on Windows that uses
    > > os.path.exists() to connect to network shares. If the various network
    > > shares require different user account and password combos than the
    > > account the script is running under the routine returns false. I need
    > > something like os.samba.path.exists(username,password,path). Does
    > > anyone have a suggestion on how I can accomplish what I need to do in
    > > Python?

    >
    > Could the Python Samba module PySamba be interesting for you?http://sourceforge.net/projects/pysamba/
    >
    > HTH,
    > Loïc
    > --
    > My blog:http://www.domaigne.com/blog


    Unfortunately, although it has the calls I'd want, pysamba appears to
    be *nix only. I need something that will work under Windows. Is there
    a set of Python Windows functions (official or contributed) that might
    do what I need? (I'm new to Python)
    BDZ, Jul 31, 2009
    #3
  4. En Fri, 31 Jul 2009 13:33:45 -0300, BDZ <> escribió:
    > On Jul 30, 4:41 pm, Loïc Domaigné <>
    > wrote:


    >> > Hello. I have written a Python 3.1 script running on Windows that uses
    >> > os.path.exists() to connect to network shares. If the various network
    >> > shares require different user account and password combos than the
    >> > account the script is running under the routine returns false. I need
    >> > something like os.samba.path.exists(username,password,path). Does
    >> > anyone have a suggestion on how I can accomplish what I need to do in
    >> > Python?

    >>
    >> Could the Python Samba module PySamba be interesting for
    >> you?http://sourceforge.net/projects/pysamba/

    >
    > Unfortunately, although it has the calls I'd want, pysamba appears to
    > be *nix only. I need something that will work under Windows. Is there
    > a set of Python Windows functions (official or contributed) that might
    > do what I need? (I'm new to Python)


    SAMBA is a Linux implementation of the SMB protocol, natively supported on
    Windows. You may use the pywin32 package (available on sourceforge.net) to
    call the WNetAddConnection2 Windows function:
    http://msdn.microsoft.com/en-us/library/aa385413(VS.85).aspx

    --
    Gabriel Genellina
    Gabriel Genellina, Aug 1, 2009
    #4
  5. Hi!

    > SAMBA is a Linux implementation of the SMB protocol, natively supported on Windows.


    Right.
    But, with Vista or Seven, only recents releases of Samba are supported.
    And, Samba know only NTLM release 2
    (in register:
    HKLM\SYSTEM\CurrentControlSet\Control\Lsa
    value LMCompatibilityLevel ; set 1 or 0.
    )

    @-salutations
    --
    Michel Claveau
    Michel Claveau - MVP, Aug 1, 2009
    #5
  6. BDZ

    BDZ Guest

    On Jul 31, 10:56 pm, "Gabriel Genellina" <>
    wrote:
    > En Fri, 31 Jul 2009 13:33:45 -0300, BDZ <> escribió:
    >
    >
    >
    > > On Jul 30, 4:41 pm, Loïc Domaigné <>
    > > wrote:
    > >> > Hello. I have written a Python 3.1 script running on Windows that uses
    > >> > os.path.exists() to connect to network shares. If the various network
    > >> > shares require different user account and password combos than the
    > >> > account the script is running under the routine returns false. I need
    > >> > something like os.samba.path.exists(username,password,path). Does
    > >> > anyone have a suggestion on how I can accomplish what I need to do in
    > >> > Python?

    >
    > >> Could the Python Samba module PySamba be interesting for  
    > >> you?http://sourceforge.net/projects/pysamba/

    >
    > > Unfortunately, although it has the calls I'd want, pysamba appears to
    > > be *nix only. I need something that will work under Windows. Is there
    > > a set of Python Windows functions (official or contributed) that might
    > > do what I need? (I'm new to Python)

    >
    > SAMBA is a Linux implementation of the SMB protocol, natively supported on
    > Windows. You may use the pywin32 package (available on sourceforge.net) to
    > call the WNetAddConnection2 Windows function:http://msdn.microsoft.com/en-us/library/aa385413(VS.85).aspx
    >
    > --
    > Gabriel Genellina


    The WNetAddConnection2 function under pywin32 seems to work. I am able
    to make connections to various SMB network resources hosted by
    Windows, Mac, and Linux boxes. It has the annoying side effect of
    opening a connection.

    There is a Win32 function called NetShareCheck. It sounds perfect. It
    just checks that the share exists (no connection left open) and does
    not require username or password. Unfortunately it fails for Mac and
    Linux SMB resources. Just FYI.

    I understand Samba and Windows SMB are not the same thing. What I was
    hoping for when I investigated pySamba was to find a python module/
    extension that supported a simple SMB interface and would run from any
    host platform.
    BDZ, Aug 6, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josef Dalcolmo

    computer names and samba shares

    Josef Dalcolmo, Jun 15, 2004, in forum: Python
    Replies:
    0
    Views:
    309
    Josef Dalcolmo
    Jun 15, 2004
  2. Tim Golden

    RE: computer names and samba shares

    Tim Golden, Jun 16, 2004, in forum: Python
    Replies:
    2
    Views:
    336
    Josef Dalcolmo
    Jun 16, 2004
  3. I.V. Aprameya Rao

    samba/windows shares

    I.V. Aprameya Rao, Dec 9, 2004, in forum: Python
    Replies:
    1
    Views:
    356
    =?ISO-8859-1?Q?Eino_M=E4kitalo?=
    Dec 10, 2004
  4. I.V. Aprameya Rao

    samba/windows shares

    I.V. Aprameya Rao, Dec 9, 2004, in forum: Python
    Replies:
    0
    Views:
    386
    I.V. Aprameya Rao
    Dec 9, 2004
  5. Michael D. Ober

    ASP.NET 2.0 site accessing Samba 3 shares

    Michael D. Ober, Sep 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    405
    Michael D. Ober
    Sep 28, 2006
Loading...

Share This Page