Re: Convert PySerial to python 3.0

2009-02-25 Thread Gabriel Genellina
En Wed, 25 Feb 2009 14:07:30 -0200, Seth escribió: This is not my code and I am fairly new to Python. I did not know how much it would take to convert pyserial to 3.0. Someone more knowledgeable than me could do it better and faster. I just want to see if I could help get it to work. The la

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
This is not my code and I am fairly new to Python. I did not know how much it would take to convert pyserial to 3.0. Someone more knowledgeable than me could do it better and faster. I just want to see if I could help get it to work. I was wrong, it seems that if type(port) in (str, bytes): or i

Re: Convert PySerial to python 3.0

2009-02-25 Thread Christian Heimes
Seth wrote: > I tried all three ways you guys listed nothing seems to convert the > string to bytes. > > It may have to do with the makeDeviceName function, but I can't find > where that is defined. > > Any thoughts?? > > Here is the whole block of code: > > if type(port) in (str, bytes):

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
I tried all three ways you guys listed nothing seems to convert the string to bytes. It may have to do with the makeDeviceName function, but I can't find where that is defined. Any thoughts?? Here is the whole block of code: if type(port) in (str, bytes): #strings are taken directly Origi

Re: Convert PySerial to python 3.0

2009-02-25 Thread Christian Heimes
Seth wrote: > I implemented "if isinstance(port, str): " that seems to work for now. > > Currently I am running into: > > err, n = win32file.WriteFile(self.hComPort, data, > self._overlappedWrite) > TypeError: expected an object with a buffer interface Unicode objects (in Py3k: str) don't implem

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
On Feb 24, 10:55 pm, Chris Rebert wrote: > On Tue, Feb 24, 2009 at 7:46 PM, Seth wrote: > > I am just messing around trying to get pyserial to work with 3.0. > > > I am stuck on this line: > > > if type(port) in [type(''), type(u'')] > > > how can I convert this to 3.0? I tried changing the u to

Re: Convert PySerial to python 3.0

2009-02-24 Thread Grant Edwards
On 2009-02-25, Chris Rebert wrote: > On Tue, Feb 24, 2009 at 7:46 PM, Seth wrote: >> I am just messing around trying to get pyserial to work with 3.0. >> >> I am stuck on this line: >> >> if type(port) in [type(''), type(u'')] >> >> how can I convert this to 3.0? I tried changing the u to a d tha

Re: Convert PySerial to python 3.0

2009-02-24 Thread Steve Holden
Seth wrote: > I am just messing around trying to get pyserial to work with 3.0. > > I am stuck on this line: > > if type(port) in [type(''), type(u'')] > > > how can I convert this to 3.0? I tried changing the u to a d that did > not do anything. > How about if type(port) in (str, bytes): Un

Re: Convert PySerial to python 3.0

2009-02-24 Thread Chris Rebert
On Tue, Feb 24, 2009 at 7:46 PM, Seth wrote: > I am just messing around trying to get pyserial to work with 3.0. > > I am stuck on this line: > > if type(port) in [type(''), type(u'')] > > > how can I convert this to 3.0? I tried changing the u to a d that did > not do anything. Looks like it's d