> 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: [email protected], [email protected]
signature.asc
Description: This is a digitally signed message part.
-- http://mail.python.org/mailman/listinfo/python-list
