Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'explicitly': 0.04; 'string.': 0.04; 'subject:Python': 0.05; 'upgraded': 0.05; 'bytes.': 0.07; 'filenames': 0.07; 'python': 0.09; 'endian': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '2.7': 0.13; 'aug': 0.13; 'static': 0.13; 'encoding': 0.15; '"normal"': 0.16; 'expects': 0.16; 'operation.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simpson': 0.16; 'written.': 0.16; 'later': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'bytes': 0.17; 'thu,': 0.17; 'unicode': 0.17; '>>>': 0.18; 'windows': 0.19; '3.x': 0.22; "i'd": 0.22; "i've": 0.23; 'device': 0.24; 'command': 0.24; 'expanding': 0.27; 'dll': 0.27; 'correct': 0.28; 'header:X-Complaints-To:1': 0.28; 'declared': 0.29; 'subject:Sending': 0.29; 'way?': 0.29; 'points': 0.29; "i'm": 0.29; 'expect': 0.31; '(and': 0.32; 'system,': 0.32; 'could': 0.32; 'getting': 0.33; 'builds': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'entry': 0.33; "can't": 0.34; 'text': 0.34; 'third': 0.34; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'functional': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.36; 'possible': 0.37; 'uses': 0.37; 'being': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'copying': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'receive': 0.71; 'points,': 0.84; 'subject:commands': 0.84; 'dennis': 0.91; 'received:108': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Sending USB commands with Python Date: Wed, 29 Aug 2012 18:56:03 -0400 Organization: > Bestiaria Support Staff < References: <20120829222932.GA18700@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-68-178-177.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346280975 news.xs4all.nl 6883 [2001:888:2000:d::a6]:55843 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28077 On Thu, 30 Aug 2012 08:29:32 +1000, Cameron Simpson declaimed the following in gmane.comp.python.general: > On 29Aug2012 17:57, Dennis Lee Bieber wrote: > | On Wed, 29 Aug 2012 14:21:30 -0700 (PDT), "Adam W." > | 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/