summaryrefslogtreecommitdiffstats
path: root/module/PluginThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-17 22:18:14 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-17 22:18:14 +0200
commit3db4587313b859f0540a8f077b27f2590881113a (patch)
tree5b355a1f8380d0fa88e14a891ee6a88c356db843 /module/PluginThread.py
parentlittle bugfix at deletePackage dialog (diff)
downloadpyload-3db4587313b859f0540a8f077b27f2590881113a.tar.xz
little fix in debug reports
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r--module/PluginThread.py44
1 files changed, 19 insertions, 25 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index ceeb0dfc5..e732d07fa 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -53,41 +53,35 @@ class PluginThread(Thread):
"""
dump_name = "debug_%s_%s" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S"))
+ dump = self.getDebugDump(pyfile)
try:
dump_name += ".zip"
- self.writeZipFile(pyfile)
- self.m.core.log.info("Debug Report written to %s" % dump_name)
+ import zipfile
+
+ zip = zipfile.ZipFile(dump_name, "w")
+
+ for f in listdir(join("tmp", pyfile.pluginname)):
+ try:
+ # avoid encoding errors
+ zip.write(join("tmp", pyfile.pluginname, f), save_join(pyfile.pluginname, f))
+ except:
+ pass
+
+ zip.writestr(save_join(pyfile.pluginname, "debug_Report.txt"), dump_name)
+ zip.close()
+
except:
dump_name += ".txt"
- dump = self.writeDebugFile(pyfile)
f = open(dump_name, "wb")
f.write(dump)
f.close()
- self.m.core.log.info("Debug Report written to %s" % dump_name)
-
- def writeZipFile(self, pyfile):
- import zipfile
-
- dump_name = "debug_%s_%s.zip" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S"))
+ self.m.core.log.info("Debug Report written to %s" % dump_name)
- zip = zipfile.ZipFile(dump_name, "w")
-
- for f in listdir(join("tmp", pyfile.pluginname)):
- try:
- # avoid encoding errors
- zip.write(join("tmp", pyfile.pluginname, f), save_join(pyfile.pluginname, f))
- except:
- pass
-
- zip.writestr(save_join(pyfile.pluginname, "debug_Report.txt"), self.writeDebugFile(pyfile))
- zip.close()
-
-
- def writeDebugFile(self, pyfile):
+ def getDebugDump(self, pyfile):
dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % (
self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc())
@@ -238,9 +232,9 @@ class DownloadThread(PluginThread):
continue
except error, e:
- try:
+ if len(e.args) == 2:
code, msg = e.args
- except:
+ else:
code = 0
msg = e.args