Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28077
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Sending USB commands with Python |
| Date | 2012-08-29 18:56 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <eq3t38542luf3dmula4k92islpa9lh0opk@invalid.netcom.com> <20120829222932.GA18700@cskk.homeip.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3947.1346280975.4697.python-list@python.org> (permalink) |
On Thu, 30 Aug 2012 08:29:32 +1000, Cameron Simpson <cs@zip.com.au>
declaimed the following in gmane.comp.python.general:
> On 29Aug2012 17:57, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> | On Wed, 29 Aug 2012 14:21:30 -0700 (PDT), "Adam W."
> | <AWasilenko@gmail.com> declaimed the following in
> | gmane.comp.python.general:
> | > You are correct about the 2 being the number of bytes written. However when I issue a read command I get:
> | >
> | > >>> ep.write('\x1BA')
> | > 4
> |
> | That's interesting -- as if each byte you send is expanding into a
> | pair of bytes.
>
> UTF-16? ISTR that Windows often uses big endian UTF-16 for filenames and
> text data; could there be some default encoding in ep.write getting in
> your way?
>
> Disclaimer: I'm really not a Windows guy.
I know W9x has both "normal" and "wide" entry points in the system,
and I think WinXP and later default to the "wide" points, but I'd expect
any third party DLL would document what it expects to receive for a
device write operation.
BUT you do give a possible clue. Is the OP using a 3.x Python where
strings are Unicode -- in which case the above may need to be explicitly
declared as a "byte string" rather than text (unicode) string.
I've only recently upgraded my desktop to Python 2.7 (and had to
make sure that copying the old "CherryTemplate" from 2.5 was still
functional -- I don't have time to rework a program that builds a set of
static web pages from database information), so can't really check on
sizes.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 18:56 -0400
Re: Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-29 16:45 -0700
Re: Sending USB commands with Python MRAB <python@mrabarnett.plus.com> - 2012-08-30 01:53 +0100
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 22:07 -0400
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-30 00:55 -0400
Re: Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-30 05:51 -0700
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-30 14:24 -0400
Re: Sending USB commands with Python Cameron Simpson <cs@zip.com.au> - 2012-08-31 08:47 +1000
csiph-web