Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.074 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'correct,': 0.09; 'immutable': 0.09; 'read()': 0.09; 'threads,': 0.09; 'threads.': 0.09; 'subject:failed': 0.16; 'threads': 0.16; 'fixed.': 0.17; 'memory': 0.18; 'idea': 0.24; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'once,': 0.29; 'usually': 0.30; 'saves': 0.30; 'problem.': 0.32; 'file': 0.32; 'much.': 0.33; 'to:addr:python-list': 0.33; 'agree': 0.34; 'done': 0.34; 'open': 0.35; 'explain': 0.36; 'but': 0.36; 'too': 0.36; 'two': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'share': 0.61; 'first': 0.61; 'between': 0.63; 'different': 0.63; 'our': 0.65; 'protect': 0.69; 'received:204': 0.72; 'demand.': 0.91; 'hands': 0.97 Date: Thu, 02 Aug 2012 12:14:14 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: CRC-checksum failed in gzip References: <50190ED6.1040100@shopzeus.com> <501956a7$0$29978$c3e8da3$5496439d@news.astraweb.com> <501961C7.1050405@shopzeus.com> <3hrpe9-hbi.ln1@satorlaser.homedns.org> In-Reply-To: <3hrpe9-hbi.ln1@satorlaser.homedns.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343902460 news.xs4all.nl 6843 [2001:888:2000:d::a6]:42169 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26393 > Technically, that is correct, but IMHO its complete nonsense to share > the file object between threads in the first place. If you need the > data in two threads, just read the file once and then share the > read-only, immutable content. If the file is small or too large to be > held in memory at once, just open and read it on demand. This also > saves you from having to rewind the file every time you read it. > > Am I missing something? We suspect that his program reads the same file object from different threads. At least this would explain his problem. I agree with you - usually it is not a good idea to share a file object between threads. This is what I told him the first time. But it is not in our hands - he already has a program that needs to be fixed. It might be easier for him to protect read() calls with a lock. Because it can be done automatically, without thinking too much.