an NTSTATUS exception type for python?

simo idra at
Fri Oct 5 08:02:59 MDT 2012

On Fri, 2012-10-05 at 11:21 +0200, Jelmer Vernooij wrote:
> On Fri, 2012-10-05 at 11:20 +1000, Andrew Bartlett wrote:
> > I wonder if you could give me a hand writing up a proper (not just
> > RuntimeException) NTSTATUS exception class for python?
> > 
> > I would like to better handle errors in setting ACLs, and while I
> > worked around the error I had by checking before the pysmbd call, it
> > seems there should be a easy way to catch an ntstatus error.
> > 
> > We probably need to get the set of NT errors into IDL (and therefore
> > python) and then create a new exception class.  
> > 
> > Do you have any specific pointers I should follow when doing this?
> So, I've been holding off on this for a while for various reasons.
> Having a common exception class means linking all Samba Python code to a
> common Samba library thing which contains it or can handle it. This was
> more of a deal before, but should be fine now.
> We also should not simply raise a NTSTATUS exception for every ntstatus
> error code (I think). E.g. NT_STATUS_NO_MEMORY should cause a
> MemoryError to be raised.
> Would you like to pair on this sometime?

Keep in mind the python bindings are now being used outside of the
project, so be mindful of changing APIs w/o very good reasons, breaking
external projects is not funny.


Simo Sorce
Samba Team GPL Compliance Officer <simo at>
Principal Software Engineer at Red Hat, Inc. <simo at>

More information about the samba-technical mailing list