fix "free variable 'mw'" error (#284)
This commit is contained in:
parent
e64d825730
commit
3584a8f004
@ -20,7 +20,14 @@ def download(mw, code):
|
|||||||
# create downloading thread
|
# create downloading thread
|
||||||
thread = Downloader(code)
|
thread = Downloader(code)
|
||||||
def onRecv():
|
def onRecv():
|
||||||
mw.progress.update(label="%dKB downloaded" % (thread.recvTotal/1024))
|
try:
|
||||||
|
mw.progress.update(label="%dKB downloaded" % (thread.recvTotal/1024))
|
||||||
|
except NameError:
|
||||||
|
# some users report the following error on long downloads
|
||||||
|
# NameError: free variable 'mw' referenced before assignment in enclosing scope
|
||||||
|
# unsure why this is happening, but guard against throwing the
|
||||||
|
# error
|
||||||
|
pass
|
||||||
mw.connect(thread, SIGNAL("recv"), onRecv)
|
mw.connect(thread, SIGNAL("recv"), onRecv)
|
||||||
thread.start()
|
thread.start()
|
||||||
mw.progress.start(immediate=True)
|
mw.progress.start(immediate=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user