Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98758
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Problems using struct pack/unpack in files, and reading them. |
| Date | Fri, 13 Nov 2015 12:36:22 -0700 |
| Lines | 12 |
| Message-ID | <mailman.298.1447443424.16136.python-list@python.org> (permalink) |
| References | <20151113192045.GA9913@z-sverige.nu> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de S0lrRW3vcib392o/mcIuEgrRS2Xnnb9eUFWRQLLdV4Xw== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'tmp': 0.07; 'subject:files': 0.09; 'subject:using': 0.09; 'def': 0.13; 'skip:p 40': 0.15; 'instead:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Problems': 0.16; 'wrote:': 0.16; 'skip:l 30': 0.18; '2015': 0.20; 'trying': 0.22; 'header:In- Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'looks': 0.29; '13,': 0.29; 'subject:/': 0.30; 'probably': 0.31; 'getting': 0.33; 'received:google.com': 0.35; 'nov': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'starting': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'ending': 0.63; '12:20': 0.84; 'kent': 0.84; 'subject:pack': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=T/ME759ilYNLJMujmt1vcGFydhdN/SLjextZ7Bn+Ytc=; b=uv0yej4xoZeOYMgrHkLaQcOubzK4iVRuum+Y9X67MC8f0xHts4JGNwxn2RiLDDnyrz i8EcSkhSqS2cMTtM2A9eZIExmd2WTcz2GKdo5iqS9VhKhw0khBD32hPqS/hahTgC6d1w O7h+H2Aq+/qQ5ZPtl863GdBG/Yrzcp4XkhFGLo1yb1MB1cCywwGUQHp3bvryMsEYVI7C SdMw13bn45oLVI0BnPyK8L9s25Rvf9CUij9wKudmM638DeVmugadv8edYjNwt6iuaEIe /PdxWshg8I2be4qmUPUkTHF3xCP2V/n1z8T1cqvH+mGoGDBoGJA8G528IY01Ye2Zt8gL C3Mg== |
| X-Received | by 10.107.19.12 with SMTP id b12mr25314861ioj.11.1447443421402; Fri, 13 Nov 2015 11:37:01 -0800 (PST) |
| In-Reply-To | <20151113192045.GA9913@z-sverige.nu> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:98758 |
Show key headers only | View raw
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg <kent@z-sverige.nu> wrote:
> def LoadCommandAndReact(place_to_read):
> global RegisterAX
>
> tmp = place_to_read.read()[RegisterAX:calcsize('HH')]
It looks like you're trying to get a slice of length 4 here, starting
at the value of RegisterAX. What you're actually getting is a slice
starting at the value of RegisterAX and ending at 4. You probably want
this instead:
tmp = place_to_read.read()[RegisterAX:RegisterAX + calcsize('HH')]
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-13 12:36 -0700
csiph-web