Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6179

Re: File access denied after subprocess completion on Windows platform

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'terry': 0.07; 'descriptor': 0.09; 'exception.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:access': 0.09; 'pm,': 0.10; 'win32': 0.12; 'wrote:': 0.14; 'delayed,': 0.16; 'fp.close()': 0.16; 'mean,': 0.16; 'mysterious': 0.16; 'reedy': 0.16; 'subject:subprocess': 0.16; 'workaround': 0.16; 'issue.': 0.19; 'solution.': 0.19; 'jan': 0.20; 'subject:Windows': 0.20; 'header:In-Reply-To:1': 0.21; 'appears': 0.21; 'seems': 0.21; 'file,': 0.22; 'elegant': 0.23; 'works.': 0.23; 'code': 0.24; 'windows': 0.26; '(the': 0.28; 'random': 0.28; 'seemingly': 0.30; 'solved': 0.30; 'header:X-Complaints-To:1': 0.32; 'to:addr:python- list': 0.33; 'experience,': 0.33; 'machine': 0.33; 'too': 0.33; 'error': 0.33; 'file': 0.34; 'follows:': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'actual': 0.36; 'issue': 0.37; 'thread': 0.37; 'think': 0.38; 'received:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'windows.': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'order': 0.62; 'opened': 0.63; 'night': 0.77; 'destination,': 0.84; 'trick.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: File access denied after subprocess completion on Windows platform
Date Tue, 24 May 2011 18:03:42 -0400
References <mailman.2013.1306231878.9059.python-list@python.org> <edf3e4cf-d706-4c33-949f-dac937a73bc9@z13g2000prk.googlegroups.com> <201105242017.27919.claudiu@virtuamagic.com> <201105242318.32306.claudiu@virtuamagic.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-6; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host rain.gmane.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
In-Reply-To <201105242318.32306.claudiu@virtuamagic.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2042.1306274632.9059.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 82.94.164.166
X-Trace 1306274632 news.xs4all.nl 49183 [::ffff:82.94.164.166]:35960
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6179

Show key headers only | View raw


On 5/24/2011 4:18 PM, Claudiu Nicolaie CISMARU wrote:
>> Seems that close_fds did the trick. Anyway, I read that description on
>> the documentation last night but I think I was so tired that I
>> understood that in Windows has no effect... :)
>
> Now. There is one more issue. Seems that on faster computers and/or
> Windows 7 (the Win32 thing I have tested on a HVM Xen machine with
> Windows XP) the os.rename is too fast after fp.close() and generates the
> same Exception. The code follows:
>
> curl.close()
> fp.close()
> os.rename(tfile, actualfile)
>
> Where, tfile is the .part file, actual file is the real destination, fp
> was opened with open(..., "wb") and the descriptor passed to curl.
>
> I have solved the issue with self.msleep(10) - msleep is a method of
> QThread. But I don't think it's an elegant and normal solution. Did
> fp.close() is delayed, or? I mean, I don't want to rely on a "sleep" in
> order to workaround the access issue.
>
> On this issue there is no more process spawn, nothing, just the
> downloader thread and the main window. And the access denied appears at
> random time.

I would go with what works. In my experience, mysterious and seemingly 
buggy error messages, including Access Denied are not unusual on Windows.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

File access denied after subprocess completion on Windows platform Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-24 13:01 +0300
  Re: File access denied after subprocess completion on Windows platform Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-24 20:17 +0300
  Re: File access denied after subprocess completion on Windows platform Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-24 23:18 +0300
  Re: File access denied after subprocess completion on Windows platform Terry Reedy <tjreedy@udel.edu> - 2011-05-24 18:03 -0400
  Re: File access denied after subprocess completion on Windows platform Tim Golden <mail@timgolden.me.uk> - 2011-05-25 08:17 +0100
  Re: File access denied after subprocess completion on Windows platform Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-25 11:20 +0300

csiph-web