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: 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 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: <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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --nextPart23760460.Irc4YAK4Nq Content-Type: Text/Plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable > Seems that close_fds did the trick. Anyway, I read that description on=20 > the documentation last night but I think I was so tired that I=20 > understood that in Windows has no effect... :) Now. There is one more issue. Seems that on faster computers and/or=20 Windows 7 (the Win32 thing I have tested on a HVM Xen machine with=20 Windows XP) the os.rename is too fast after fp.close() and generates the=20 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=20 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=20 QThread. But I don't think it's an elegant and normal solution. Did=20 fp.close() is delayed, or? I mean, I don't want to rely on a "sleep" in=20 order to workaround the access issue. On this issue there is no more process spawn, nothing, just the=20 downloader thread and the main window. And the access denied appears at=20 random time. =2D-=20 Claudiu Nicolaie CISMARU GNU GPG Key: http://claudiu.targujiu.net/key.gpg T: +40 755 135455 E: claudiu@virtuamagic.com, claudiu.cismaru@gmail.com --nextPart23760460.Irc4YAK4Nq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEABECAAYFAk3cEpgACgkQhU2qCxfP7CqWVACgqp8EQ1VtJJHSvt+5xcOT53DW IzQAnR5PpRhRXhzVPz68XImVUM5B4VeH =tPKH -----END PGP SIGNATURE----- --nextPart23760460.Irc4YAK4Nq--