Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'interpreted': 0.07; 'lines.': 0.07; '"a"': 0.09; 'encode': 0.09; 'notation': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'aug': 0.13; 'read.': 0.13; 'weird': 0.15; '8-bit': 0.16; 'hex': 0.16; 'introduces': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stripped': 0.16; 'wed,': 0.16; 'string': 0.17; 'byte': 0.17; 'bytes': 0.17; 'odd': 0.17; 'trying': 0.21; 'work,': 0.22; 'example': 0.23; 'skip:e 40': 0.27; 'regular': 0.27; 'header:X-Complaints-To:1': 0.28; 'subject:Sending': 0.29; 'stuff': 0.30; 'print': 0.32; 'getting': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'text.': 0.35; 'received:org': 0.36; 'really': 0.36; 'explain': 0.36; 'but': 0.36; 'subject:with': 0.36; 'charset:us- ascii': 0.36; 'does': 0.37; 'two': 0.37; 'being': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'claim': 0.60; 'easy': 0.60; 'times': 0.63; 'results': 0.65; 'bar:': 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: Thu, 30 Aug 2012 00:55:03 -0400 Organization: > Bestiaria Support Staff < References: <20120829222932.GA18700@cskk.homeip.net> <5d063028-3d3f-42f2-8787-b33d58460c35@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-68-176-60.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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346302513 news.xs4all.nl 6841 [2001:888:2000:d::a6]:53992 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28088 On Wed, 29 Aug 2012 20:53:48 -0700 (PDT), "Adam W." declaimed the following in gmane.comp.python.general: > Your notation does work, and I was just coming around to reevaluating the use of the encode because I am getting really odd results when trying to print lines. > > For example I set the byte length to 10 and sent this 500 times or so expecting to get a solid black bar: > ep.write('\x16FFFFFFFFFF'.encode('utf-8')) How many bytes did it claim to send? > > But what I got was a weird stripped pattern... I feel like a lot of my commands are working by chance, I can't explain to myself why the A in \x1bA isn't being treated as part of the hex. This stuff always confuses me. > That's the easy one -- \x in a string introduces an 8-bit byte value -- so only two hex digits well be read. The "A" is interpreted as regular text. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/