Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(14)  |  Call(12)  |  Derive(0)  |  Import(2)

src/p/y/pylibftdi-0.14.1/pylibftdi/device.py   pylibftdi(Download)
from ctypes import byref, create_string_buffer, c_char_p
 
from pylibftdi._base import FtdiError
from pylibftdi.driver import (
        Driver, USB_VID_LIST, USB_PID_LIST,
            msg = "%s (%d)" % (self.get_error_string(), res)
            del self.ctx
            raise FtdiError(msg)
 
        if self.interface_select is not None:
                msg = "%s (%d)" % (self.get_error_string(), res)
                del self.ctx
                raise FtdiError(msg)
 
        # Try to open the device.  If this fails, reset things to how
            self.fdll.ftdi_deinit(byref(self.ctx))
            del self.ctx
            raise FtdiError(msg)
 
        # explicitly reset the device to serial mode with standard settings
        rlen = self.fdll.ftdi_read_data(byref(self.ctx), byref(buf), length)
        if rlen < 0:
            raise FtdiError(self.get_error_string())
        byte_data = buf.raw[:rlen]
 

src/p/y/pylibftdi-0.14.1/pylibftdi/driver.py   pylibftdi(Download)
from ctypes.util import find_library
 
from pylibftdi._base import FtdiError
 
 
                break
        if ftdi_lib is None:
            raise FtdiError('libftdi library not found (search: {})'.format(search_list))
        return ftdi_lib
 
        if self.fdll.ftdi_init(byref(ctx)) != 0:
            msg = self.fdll.ftdi_get_error_string(byref(ctx))
            raise FtdiError(msg)
 
        try:
                    err_msg = self.fdll.ftdi_get_error_string(byref(ctx))
                    msg = "%s (%d)" % (err_msg, res)
                    raise FtdiError(msg)
                elif res > 0:
                    # take a copy of the dev_list for subsequent list_free
                                err_msg = self.fdll.ftdi_get_error_string(byref(ctx))
                                msg = "%s (%d)" % (err_msg, res)
                                raise FtdiError(msg)
                            devices.append((manuf.value, desc.value, serial.value))
                            # step to next in linked-list