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


Groups > comp.lang.python > #6171

Re: File access denied after subprocess completion on Windows platform

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <claudiu@virtuamagic.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'content- type:multipart/signed': 0.09; 'descriptor': 0.09; 'exception.': 0.09; 'subject:access': 0.09; 'win32': 0.12; 'content- type:application/pgp-signature': 0.16; 'delayed,': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname piece:signature': 0.16; 'filename:fname:signature.asc': 0.16; 'fp.close()': 0.16; 'mean,': 0.16; 'subject:subprocess': 0.16; 'workaround': 0.16; 'issue.': 0.19; 'solution.': 0.19; 'subject:Windows': 0.20; 'header:In-Reply-To:1': 0.21; 'appears': 0.21; 'seems': 0.21; 'file,': 0.22; 'elegant': 0.23; 'code': 0.24; 'windows': 0.26; '(the': 0.28; 'random': 0.28; 'solved': 0.30; 'url:key': 0.30; 'to:addr:python-list': 0.33; 'machine': 0.33; 'too': 0.33; 'file': 0.34; 'follows:': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'gnu': 0.35; 'actual': 0.36; 'issue': 0.37; 'thread': 0.37; 'think': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'more': 0.60; 'header:Message- Id:1': 0.62; 'order': 0.62; 'opened': 0.63; 'url:net': 0.63; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'night': 0.77; 'destination,': 0.84; 'trick.': 0.84
From Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com>
Organization virtuaMAGIC
To python-list@python.org
Subject Re: File access denied after subprocess completion on Windows platform
Date Tue, 24 May 2011 23:18:28 +0300
User-Agent KMail/1.13.7 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.3; i686; ; )
References <mailman.2013.1306231878.9059.python-list@python.org> <edf3e4cf-d706-4c33-949f-dac937a73bc9@z13g2000prk.googlegroups.com> <201105242017.27919.claudiu@virtuamagic.com>
In-Reply-To <201105242017.27919.claudiu@virtuamagic.com>
MIME-Version 1.0
Content-Type multipart/signed; boundary="nextPart23760460.Irc4YAK4Nq"; protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To claudiu@virtuamagic.com
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.2037.1306268314.9059.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 82.94.164.166
X-Trace 1306268314 news.xs4all.nl 49174 [::ffff:82.94.164.166]:37583
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6171

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

> 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.

-- 
  Claudiu Nicolaie CISMARU
  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
  T: +40 755 135455
  E: claudiu@virtuamagic.com, claudiu.cismaru@gmail.com

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