Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98767
| 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 14:00:36 -0700 |
| Lines | 11 |
| Message-ID | <mailman.306.1447448484.16136.python-list@python.org> (permalink) |
| References | <20151113192045.GA9913@z-sverige.nu> <CALwzidnL1N8efgJfM-EKTgqzmDjg2QwcZVVmDXJB2_QGyFnExA@mail.gmail.com> <20151113201510.GA10107@z-sverige.nu> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de K954Nloxfbo+R+sLNLN1cQTp632eOPNrN57CN2h4r6eQ== |
| 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.082 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'subject:files': 0.09; 'subject:using': 0.09; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Problems': 0.16; 'wrote:': 0.16; 'string': 0.17; '2015': 0.20; 'second': 0.24; 'tried': 0.24; 'header:In-Reply- To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; '13,': 0.29; 'subject:/': 0.30; 'error.': 0.31; 'retain': 0.33; 'case,': 0.34; 'file': 0.34; 'that,': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'nov': 0.35; 'received:209.85': 0.36; 'closing': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'your': 0.60; 'between': 0.65; 'calls,': 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=tZRGZl7gRdB7A3nPy37mqe2kbmPiB7eHFy3N19yOHtQ=; b=XuQu8MZUqjwKw/SKf5owfS/1Zbho6cnvfHipooKCS4alBZhKCPLLHRfIaUYRbH2Qu2 VI2T5jV3hY/X9v7kUtuQUPIOymQ76vZZoo6s+V2wSSzkfIQbDyZVSxp601736lAMISNL GzY/eLM2gNlCROfBZtOqV3pfxPxi4j4v8ZVfQMenYNabewZ59uvkvy0w0VhzeDnMtm3U 4FxX4Asuvf7d4Y9vyoBGhU2DxwSVfrA8GAcdXpj/iMq/+WgQtlZfWmh6QMwZgMIHH+xD 0L4k8KQA438eH8yotCw+/yIZZYM7R3Fa+C9ujFs0WRDwNsjuhVG44MPuHBFyhzSQyB3t uY/Q== |
| X-Received | by 10.50.78.231 with SMTP id e7mr5544389igx.93.1447448476406; Fri, 13 Nov 2015 13:01:16 -0800 (PST) |
| In-Reply-To | <20151113201510.GA10107@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:98767 |
Show key headers only | View raw
On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg <kent@z-sverige.nu> wrote: > Even with that, it still gets wrong. > I also tried .read()[RegisterAX:RegisterAX+4] When you call read for the second time, are you just reading the same file again without closing or seeking it in the interim? If that's the case, then you would get an empty string the second time, which would explain your error. Either retain the read data between calls, or call seek(0) before reading it again.
Back to comp.lang.python | Previous | Next — Next in thread | 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 14:00 -0700
Re: Problems using struct pack/unpack in files, and reading them. Grant Edwards <invalid@invalid.invalid> - 2015-11-13 21:17 +0000
Re: Problems using struct pack/unpack in files, and reading them. kent nyberg <kent@z-sverige.nu> - 2015-11-13 16:34 -0500
Re: Problems using struct pack/unpack in files, and reading them. Grant Edwards <invalid@invalid.invalid> - 2015-11-13 21:44 +0000
csiph-web