pysmbc
This page is about the Python bindings for the libsmbclient API from Samba, known as pysmbc. It was written for use with system-config-printer, but can be put to other uses as well.
I used to work on this module as part of my job at Red Hat. It is now maintained by HAMANO Tsukasa.
Download
Download tarball releases from the Python Package Index:
http://pypi.python.org/pypi/pysmbc/
Download older tarball releases from:
http://cyberelk.net/tim/data/pysmbc/
Source Code
Fetch the source code like this:
git clone http://github.com/hamano/pysmbc.git
Great tool, but I was not able to use it.
Wow, I’ve submitted ticket #1: https://fedorahosted.org/pysmbc/ticket/1#preview
I think I’m able to fix it myself, but I know almost nothing about libsmbclient and not sure what smbc_bool actually is.
It’s because you’re using an older version of libsmbclient than pysmbc currently supports.
Hi there,
This is a very useful tool for me, although I am experiencing a problem with version 1.0.10 – when trying to transfer certain non-utf8 files like documents and PDF files, this results in an exception. I have traced down the problem, found a fix, and submitted a ticket at Fedora – please take a look when you have the time – https://fedorahosted.org/pysmbc/ticket/3
Cheers,
Yavor
Hi,
This module looks perfect for my needs, but I’m getting build errors, because my libsmbclient.h doesn’t declare smbc_open_fn. Can you document the supported version(s) of libsbmclient ?
Thanks,
Graeme
Currently libsmbclient 3.2.x or later is required.
I’m trying this out on a DFS and seeing an error when trying to navigate to a share where SMB signing is required:
>>> ctx.stat(“smb://<>/optimus/IronHide”)
cli_negprot: SMB signing is mandatory and we have disabled it.
protocol negotiation failed
Couldn’t resolve \IronHide
It seems adding “client signing = auto” to my smb.conf file does not fix the error. I don’t see an attribute in the Context object to change. Is there a way to allow SMB Signing with pysmbc?
Thanks,
Robert
The only part of the libsmbclient interface that seems relevant is “smbc_set_credentials” which includes a parameter for “signing state” (on/off/force). Maybe I should make that function available.
I just checked in a change to add Context.set_credentials_with_fallback. The function I mentioned earlier seems to be deprecated in favour of this one, although it doesn’t have a parameter about signing state. Might be worth trying out though. Let me know if it helps.
Hi Tim,
Thank you so much for this suite – it’s come in very handy for a project I’m working on in my job.
I made a couple of modifications, and am wondering what’s the best way to submit these to you and/or incorporate them into the upstream.
– I’ve added methods “statvfs()” and “utime()” (both are available in libsmbclient and also conforms to similar methods in Python’s “os” module; “statvfs” constants can be pulled from the “statvfs” module)
– I’ve subclassed all your exceptions from “OSError”, so that they can be caught (and abstracted w.r.t. similar calls on local files) using “except EnvironmentError”. You already include the proper “errno” attribute. I haven’t had a need to add “filename”, but that could probably be added as well.
Let me know if you’re interested in a diff, and/or want me to commit the code somewhere.
Regards,
-tor
Hi,
I updated the page to point to the current maintainer’s GitHub repository. I would suggest submitting a pull requests there (hamano/pysmbc).