The string is unicode. This was only an example. I solved the problem by
doing
*end_point.write(str.encode('utf-8'))*
On Thu, Dec 22, 2016 at 1:09 PM, Nicolas Pinault <nicol...@aaton.com> wrote:
> Hi,
>
> Le 21/12/2016 à 18:18, Mayur Vijaywargi a écrit :
>
> 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('¥À')
>
> This is not a pyusb problem.
> Since you wrote '¥À' and not u'¥À' , I assume you use Python3.
> Even with Python3, you have to specify the source encoding at the first
> line of the file like the following.
> # -*- coding: UTF-8 -*-
> When not specified, Python3 considers you use UTF8 encoding.
>
>
>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/intel
>
>
>
> _______________________________________________
> pyusb-users mailing
> listpyusb-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/pyusb-users
>
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/intel
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users