diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-09-21 18:18:27 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-09-21 18:18:27 +0200 |
commit | fb72b1700e6e0ce473695a0fe98e0a2ffccbed18 (patch) | |
tree | a4f2e7aa208526541397633d5284ed717ad610cf /module/PluginThread.py | |
parent | royflos GUI patches, prefix option for webinterface ( (diff) | |
download | pyload-fb72b1700e6e0ce473695a0fe98e0a2ffccbed18.tar.xz |
catch error in debug report
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r-- | module/PluginThread.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index 269500081..dcbe88c71 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -20,7 +20,7 @@ from Queue import Queue from threading import Thread -from os import listdir +from os import listdir, stat from os.path import join from time import sleep, time, strftime from traceback import print_exc, format_exc @@ -52,13 +52,12 @@ class PluginThread(Thread): :return: """ - dump_name = "debug_%s_%s" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) + dump_name = "debug_%s_%s.zip" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) dump = self.getDebugDump(pyfile) try: import zipfile - dump_name += ".zip" zip = zipfile.ZipFile(dump_name, "w") for f in listdir(join("tmp", pyfile.pluginname)): @@ -71,9 +70,13 @@ class PluginThread(Thread): zip.writestr(save_join(pyfile.pluginname, "debug_Report.txt"), dump) zip.close() + if not stat(dump_name).st_size: + raise Exception("Empty Zipfile") - except: - dump_name += ".txt" + except Exception, e: + self.m.log.debug("Error creating zip file: %s" % e) + + dump_name = dump_name.replace(".zip", ".txt") f = open(dump_name, "wb") f.write(dump) f.close() |