pywincffi package

Submodules

pywincffi.exceptions module

Exceptions

Custom exceptions that pywincffi can throw.

exception pywincffi.exceptions.ConfigurationError[source]

Bases: pywincffi.exceptions.InternalError

Raised when there was a problem with the configuration file

exception pywincffi.exceptions.InputError(name, value, allowed_types=None, allowed_values=None, ffi=None, message=None)[source]

Bases: pywincffi.exceptions.PyWinCFFIError

A subclass of PyWinCFFIError that’s raised when invalid input is provided to a function. Because we’re passing inputs to C we have to be sure that the input(s) being provided are what we’re expecting so we fail early and provide better error messages.

Parameters:
  • name (str) – The name of the parameter being checked.
  • value – The value of the parameter being checked.
  • allowed_types – The expected type(s). If provided then the exception’s message will be tailored to provide information about value’s type and the possible input types.
  • allowed_values – The expected value(s). If provided then the exception’s message will be tailored to provide information about what value(s) were allowed for value.
  • ffi – If value is a C object, ffi is provided and allowed_types is provided as well then the provided ffi instance will be used to provide additional context.
  • message (str) – A custom error message. This will override the default error messages which InputError would normally generate. This can be helpful if there is a problem with a given input parameter to a function but it’s unrelated to the type of input.
exception pywincffi.exceptions.InternalError[source]

Bases: pywincffi.exceptions.PyWinCFFIError

Raised if we encounter an internal error. Most likely this is an indication of a bug in pywincffi but it could also be a problem caused by an unexpected use case.

exception pywincffi.exceptions.PyWinCFFIError[source]

Bases: exceptions.Exception

The base class for all custom exceptions that pywincffi can throw.

exception pywincffi.exceptions.PyWinCFFINotImplementedError[source]

Bases: pywincffi.exceptions.InternalError

Raised if we encounter a situation where we can’t figure out what to do. The message for this error should contain all the information necessary to implement a future work around.

exception pywincffi.exceptions.ResourceNotFoundError[source]

Bases: pywincffi.exceptions.InternalError

Raised when we fail to locate a specific resource

exception pywincffi.exceptions.WindowsAPIError(function, error, errno, return_code=None, expected_return_code=None)[source]

Bases: pywincffi.exceptions.PyWinCFFIError

A subclass of PyWinCFFIError that’s raised when there was a problem calling a Windows API function.

Parameters:
  • function (str) – The Windows API function being called when the error was raised.
  • error (str) – A string representation of the error message.
  • errno (int) – An integer representing the error. This usually represents a constant which Windows has produced in response to a problem.
  • return_code (int) – If the return value of a function has been checked the resulting code will be set as this value.
  • expected_return_code (int) – The value we expected to receive for code.

Module contents

PyWinCFFI

The root of the pywincffi package. See the README and documentation for help and examples.