os.path.exists() and Samba shares

B

BDZ

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?
 
L

Loïc Domaigné

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
 
B

BDZ

Hi,


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

HTH,
Loïc

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)
 
G

Gabriel Genellina

On Jul 30, 4:41 pm, Loïc Domaigné <[email protected]>
wrote:

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
 
M

Michel Claveau - MVP

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
 
B

BDZ

En Fri, 31 Jul 2009 13:33:45 -0300, BDZ <[email protected]> escribió:





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

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top