~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Blake Winton
  • Date: 2007-10-16 16:02:01 UTC
  • mto: This revision was merged to the branch mainline in revision 2921.
  • Revision ID: bwinton@latte.ca-20071016160201-os2bci2ujf7in7an
Change 'print >> f,'s to 'f.write('s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
324
324
    log_exception_quietly()
325
325
    if (isinstance(exc_object, IOError)
326
326
        and getattr(exc_object, 'errno', None) == errno.EPIPE):
327
 
        print >>err_file, "bzr: broken pipe"
 
327
        err_file.write("bzr: broken pipe\n")
328
328
        return errors.EXIT_ERROR
329
329
    elif isinstance(exc_object, KeyboardInterrupt):
330
 
        print >>err_file, "bzr: interrupted"
 
330
        err_file.write("bzr: interrupted\n")
331
331
        return errors.EXIT_ERROR
332
332
    elif not getattr(exc_object, 'internal_error', True):
333
333
        report_user_error(exc_info, err_file)
351
351
    if 'error' in debug.debug_flags:
352
352
        report_bug(exc_info, err_file)
353
353
        return
354
 
    print >>err_file, "bzr: ERROR:", str(exc_info[1])
 
354
    err_file.write("bzr: ERROR:" + ' ' + str(exc_info[1]) + '\n')
355
355
 
356
356
 
357
357
def report_bug(exc_info, err_file):
358
358
    """Report an exception that probably indicates a bug in bzr"""
359
359
    import traceback
360
360
    exc_type, exc_object, exc_tb = exc_info
361
 
    print >>err_file, "bzr: ERROR: %s.%s: %s" % (
362
 
        exc_type.__module__, exc_type.__name__, exc_object)
363
 
    print >>err_file
 
361
    err_file.write("bzr: ERROR: %s.%s: %s\n" % (
 
362
        exc_type.__module__, exc_type.__name__, exc_object))
 
363
    err_file.write('\n')
364
364
    traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
365
 
    print >>err_file
366
 
    print >>err_file, 'bzr %s on python %s (%s)' % \
 
365
    err_file.write('\n')
 
366
    err_file.write('bzr %s on python %s (%s)\n' % \
367
367
                       (bzrlib.__version__,
368
368
                        '.'.join(map(str, sys.version_info)),
369
 
                        sys.platform)
370
 
    print >>err_file, 'arguments: %r' % sys.argv
 
369
                        sys.platform))
 
370
    err_file.write('arguments: %r\n' % sys.argv)
371
371
    err_file.write(
372
372
        'encoding: %r, fsenc: %r, lang: %r\n' % (
373
373
            osutils.get_user_encoding(), sys.getfilesystemencoding(),