diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 89d195e4cd..e70f85b9a6 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -161,12 +161,12 @@ class Command(BaseCommand): transaction.rollback() transaction.leave_transaction_management() if show_traceback: - import traceback traceback.print_exc() else: sys.stderr.write( self.style.ERROR("Problem installing fixture '%s': %s\n" % - (full_path, traceback.format_exc()))) + (full_path, ''.join(traceback.format_exception(sys.exc_type, + sys.exc_value, sys.exc_traceback))))) return fixture.close()