Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6209
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'anyway': 0.03; 'antivirus.': 0.07; 'ret': 0.07; 'python': 0.08; "(it's": 0.09; 'content-type:multipart/signed': 0.09; 'dive': 0.09; 'retcode': 0.09; 'subject:access': 0.09; 'subprocess': 0.09; 'files.': 0.10; 'def': 0.12; 'exception': 0.12; '30)': 0.16; 'blah': 0.16; 'content-type:application/pgp-signature': 0.16; 'curl': 0.16; 'except:': 0.16; 'filename)': 0.16; 'filename,': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname piece:signature': 0.16; 'filename:fname:signature.asc': 0.16; 'fp)': 0.16; 'fp.close()': 0.16; 'iirc,': 0.16; 'subject:subprocess': 0.16; 'traceback.': 0.16; 'issue.': 0.19; 'subject:Windows': 0.20; 'header:In-Reply-To:1': 0.21; "wasn't": 0.22; 'code.': 0.22; 'maybe': 0.23; 'clause': 0.23; 'tests.': 0.23; 'runs': 0.23; 'code': 0.24; "i'm": 0.27; 'raise': 0.28; 'problem': 0.28; 'affected': 0.29; 'problema': 0.29; 'instead': 0.29; 'version': 0.29; 'bit': 0.30; 'fact': 0.30; 'disabled': 0.30; 'sleep': 0.30; 'url:key': 0.30; 'varies': 0.30; "didn't": 0.31; 'print': 0.31; 'done': 0.32; 'yet': 0.32; 'to:addr:python- list': 0.33; 'machine': 0.33; '...': 0.34; "i'll": 0.34; 'file': 0.34; "we're": 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'gnu': 0.35; 'try:': 0.35; 'skip:o 20': 0.37; 'something': 0.37; 'hack': 0.37; 'think': 0.38; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'skip:s 20': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'within': 0.60; 'header:Message-Id:1': 0.62; 'closed': 0.62; 'back': 0.63; 'url:net': 0.63; 'virus': 0.63; 'cause': 0.67; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'attempted': 0.73; '"":': 0.84; ':).': 0.84; 'catches': 0.84; 'ugly,': 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 | Wed, 25 May 2011 11:20:45 +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> <201105242318.32306.claudiu@virtuamagic.com> <4DDCAD12.4050203@timgolden.me.uk> |
| In-Reply-To | <4DDCAD12.4050203@timgolden.me.uk> |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; boundary="nextPart1417754.9mQuc9Cu1C"; 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.2058.1306311652.9059.python-list@python.org> (permalink) |
| Lines | 123 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306311652 news.xs4all.nl 49181 [::ffff:82.94.164.166]:57792 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6209 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
> There used to be a problem with subprocess fds being held by
> a traceback. IIRC, the problem could be triggered by having
> an except clause around a subprocess call within which something
> attempted to, eg,
> remove one of the affected files.
I have no subprocess call.. in this last issue. And I didn't triggered
one (disabled the Button that runs the subprocess).
try:
for line in t.splitlines():
[...]
ret = self.downloadFileToDisk(filename, do_rename)
if not ret:
print "DEBUG: Problema la download"
raise Exception()
(1) except Exception as inst:
print type(inst)
print inst.args
self.updateText.emit("EROARE: Eroare la descarcare")
self.updateStatusBar.emit("EROARE: Eroare la descaracare
fisiere")
return
Where downloadFileToDisk():
def downloadFileToDisk(self, filename, final_rename=True):
dfilename = os.path.join(saveBasePATH, filename)
sfilename = dfilename + ".part"
dfolder = os.path.dirname(sfilename)
if dfolder != "":
if not os.path.isdir(dfolder):
os.makedirs(dfolder)
try:
fp = open(sfilename, "wb")
except:
return False
curl = pycurl.Curl()
curl.setopt(pycurl.URL, baseUpdateURL + "/client/" + filename)
curl.setopt(pycurl.CONNECTTIMEOUT, 30)
curl.setopt(pycurl.NOPROGRESS, 0)
curl.setopt(pycurl.FOLLOWLOCATION, 1)
curl.setopt(pycurl.MAXREDIRS, 5)
curl.setopt(pycurl.PROGRESSFUNCTION, self.updateFileProgress)
curl.setopt(pycurl.WRITEDATA, fp)
curl.setopt(pycurl.BUFFERSIZE, 4194304)
curl.setopt(pycurl.NOSIGNAL, 1)
curl.perform()
retcode = curl.getinfo(pycurl.HTTP_CODE)
curl.close()
fp.close()
if retcode != 200:
(2) os.unlink(sfilename)
return False
self.msleep(10)
if final_rename:
os.rename(sfilename, dfilename)
return True
Without self.msleep(10), (1) catches WindowsError: file access ... blah
blah. Maybe at (2) can be an access violation, but it wasn't triggered
yet in tests. I will move the sleep after fp.close(). Yes, I know that
what it've done with raise Exception() is UGLY, since this program it's
more a quick hack solution to a problem :). Anyway the Exception that is
catched is not rised by my code (it's a WindowsError).
> I'm sorry if that's a bit
> of a woolly description but if you think this might be
> biting you I'll dive in and look at the code. What version
> of Python are you using?
Last 2.7.x. Well, if os.rename is instead a subprocess call, then it's
subprocess based. I'm new to Python but 99% I think it's a system call
:)
> (That said, the fact that the behaviour varies between faster
> and slower computers makes that cause unlikely. Maybe we're
> back to looking at virus checkers and the like...)
On that virtual machine there is no virus checker. On the faster machine
I disabled and closed the antivirus.
--
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 | Next — Previous in thread | Find similar | Unroll 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