def createInputBuffer(file, encoding):
    """Create a libxml2 input buffer from a Python file """
    ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
    if ret is None:raise treeError('xmlCreateInputBuffer() failed')
    return inputBuffer(_obj=ret)