Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Wander Lairson Costa
2013/1/27 Steven Michalske : > > > On Jan 27, 2013, at 3:35 PM, Wander Lairson Costa > wrote: > > _interop.as_array(s.encode('ut8')) > > > Ahh, I read the _ and thought it was a private module. > Yes, it is, but any public function will forward user parameter to this function... -- Best Regards

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Steven Michalske
On Jan 27, 2013, at 3:35 PM, Wander Lairson Costa wrote: > _interop.as_array(s.encode('ut8')) Ahh, I read the _ and thought it was a private module.-- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CS

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Wander Lairson Costa
2013/1/27 Steven Michalske : > How can the user decide in your method? I don't see it. > _interop.as_array(s.encode('ut8')) -- Best Regards, Wander Lairson Costa -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 20

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Steven Michalske
On Jan 26, 2013, at 11:04 AM, wander.lair...@gmail.com wrote: > From: Wander Lairson Costa > > In usb/_interop.py in the as_array function, the array typecodes 'c' and > 'u' are used. The 'c' typecode was removed from python 3.3 and 'u' will > is deprecated. The solution is to use the fromstrin

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Steven Michalske
How can the user decide in your method? I don't see it. Steve On Jan 27, 2013, at 3:15 AM, Wander Lairson Costa wrote: > 2013/1/26 Steven Michalske : >> What about this? >> Tested in python 2.7 and 3.3 >> >> a = array.array("B") >> s=u"abcꬦ" >> try: >>a.fromstring(s.encode('ascii')) >

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-27 Thread Wander Lairson Costa
2013/1/26 Steven Michalske : > What about this? > Tested in python 2.7 and 3.3 > > a = array.array("B") > s=u"abcꬦ" > try: > a.fromstring(s.encode('ascii')) > except UnicodeEncodeError: > a.fromstring(s.encode('utf8')) > print(a) > array('B', [97, 98, 99, 234, 172, 166]) > > a = array.array

Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-26 Thread Steven Michalske
What about this? Tested in python 2.7 and 3.3 a = array.array("B") s=u"abcꬦ" try: a.fromstring(s.encode('ascii')) except UnicodeEncodeError: a.fromstring(s.encode('utf8')) print(a) array('B', [97, 98, 99, 234, 172, 166]) a = array.array("B") s="abc" try: a.fromstring(s.encode('ascii')

[pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.

2013-01-26 Thread wander . lairson
From: Wander Lairson Costa In usb/_interop.py in the as_array function, the array typecodes 'c' and 'u' are used. The 'c' typecode was removed from python 3.3 and 'u' will is deprecated. The solution is to use the fromstring array method, but it has the side effect of adding only the first byte o