python and samba

Fatih Tumen fthtmn at
Sun May 17 12:18:07 CEST 2009

I am working on a directory synchronisation tool for Linux.

$ gcc --version
gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
$ python -V
Python 2.5.2
$ smbclient --version
Version 3.0.28a

I first designed it to work on the local filesystem. I am using
(distributed with Python) for comparing the files. Of course I had to
modify it in a way that it will return object rather than stdout. I have
this compare method in my main class which is os.walk()-ing through
the directories and labeling the files on the GUI according to this returned

object by
Now I want add support for syncing between (unix and NT) network
shares without having to change my abstraction much. At first googling
I hit a samba discussion appeared on this list ages ago. It did not help me
much though. I also found this pysmbc, libsmbclient bindings, written by
Tim Waug but it requires libsmbclient-3.2.x. which requires
libc6 >= 2.8~20080505 which comes with Intreprid but I have reasons
not to upgrade my Hardy.
Another thing I found was pysamba, by Juan M. Casillas,  but it needs
a bit of hack; samba needs to be configured with python.
I am looking for something that won't bother the end user nor me. I want
to keep it as simple as possible. I will distribute the libraries myself if
I have
to and if licence is not an issue.

If I have to summarise, I need to get m_time and size (and preferably stick
os.walk and if possible) and copy files back and forth using
samba (unix <-> NT).  I don't wanna reinvent the wheel or overengineer
anything but if I can do this without any additional libraries, great!

I would appreciate any advice on this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list