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

10 Responses to “pysmbc”

  1. 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.

  2. tim says:

    It’s because you’re using an older version of libsmbclient than pysmbc currently supports.

  3. Yavor says:

    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

  4. Graeme says:

    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

  5. Robert says:

    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

    • Tim says:

      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.

    • Tim says:

      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.

  6. Tor says:

    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

Leave a reply

Comments are moderated. Comments that are inappropriate, offensive, vulgar, badly written or insulting will be deleted or edited to make the author look silly.