util/ExceptionHandler.py
branchpython3
changeset 3750 f62625418bff
parent 3546 ee51d1deadfd
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
    22 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 
    26 
    27 from __future__ import absolute_import
    27 
    28 import os
    28 import os
    29 import sys
    29 import sys
    30 import time
    30 import time
    31 import tempfile
    31 import tempfile
    32 import platform
    32 import platform
    91 
    91 
    92     return tb
    92     return tb
    93 
    93 
    94 
    94 
    95 def format_namespace(d, indent='    '):
    95 def format_namespace(d, indent='    '):
    96     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
    96     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.items()])
    97 
    97 
    98 
    98 
    99 ignored_exceptions = []  # a problem with a line in a module is only reported once per session
    99 ignored_exceptions = []  # a problem with a line in a module is only reported once per session
   100 
   100 
   101 
   101 
   127                     pass
   127                     pass
   128         path = os.path.dirname(bug_report_path)
   128         path = os.path.dirname(bug_report_path)
   129         if not os.path.exists(path):
   129         if not os.path.exists(path):
   130             os.mkdir(path)
   130             os.mkdir(path)
   131         output = open(bug_report_path, 'w')
   131         output = open(bug_report_path, 'w')
   132         lst = info.keys()
   132         lst = list(info.keys())
   133         lst.sort()
   133         lst.sort()
   134         for a in lst:
   134         for a in lst:
   135             line = a + ":\n" + str(info[a]) + "\n\n"
   135             line = a + ":\n" + str(info[a]) + "\n\n"
   136             output.write(line)
   136             output.write(line)
   137             if logf is not None:
   137             if logf is not None: