From: Mayur V. <ma...@ma...> - 2016-12-21 17:18:32
|
Hi, I am getting this kind of error "'ascii' codec can't encode character u'\u010c' in position 6: ordinal not in range(128)" This the code I am using to search endpoint to write: def get_device(vid, pid, backend_driver=None): if backend_driver is not None: return core.find(idVendor=vid, idProduct=pid, backend=backend_driver) else: return core.find(idVendor=vid, idProduct=pid) def searhDevices(): backend = None if os.name == "nt": backend = libusb1.get_backend(find_library=lambda x: "dll/libusb0_x86.dll") device = None for each_device in supported_devices: device = get_device(each_device.get('vid'), each_device.get('pid'), backend) if device is not None: response['line_size'] = each_device.get("line_size") break if device is None: raise ValueError('Device not found') device.set_configuration() config = device.get_active_configuration() for intf in config: for each_endpoint in intf: global end_point end_point = util.find_descriptor( intf, custom_match=lambda e: util.endpoint_direction(e.bEndpointAddress) == util.ENDPOINT_OUT) if end_point is not None: break if end_point is None: raise ValueError('End point not found') end_point.write('¥À') |