@@ -452,24 +452,25 @@ def process_input(self, data, input_prompt, lineno):
452452 # unless :okexcept: has been specified.
453453 if not is_okexcept and "Traceback" in output :
454454 s = "\n Exception in %s at block ending on line %s\n " % (filename , lineno )
455- sys .stdout .write ('\n \n >>>' + '-' * 73 )
455+ s += "Specify :okexcept: as an option in the ipython:: block to suppress this message\n "
456+ sys .stdout .write ('\n \n >>>' + ('-' * 73 ))
456457 sys .stdout .write (s )
457458 sys .stdout .write (output )
458- sys .stdout .write ('<<<' + '-' * 73 + '\n \n ' )
459+ sys .stdout .write ('<<<' + ( '-' * 73 ) + '\n \n ' )
459460
460461 # output any warning raised during execution to stdout
461462 # unless :okwarning: has been specified.
462463 if not is_okwarning :
463- import textwrap
464464 for w in ws :
465465 s = "\n Warning in %s at block ending on line %s\n " % (filename , lineno )
466- sys .stdout .write ('\n \n >>>' + '-' * 73 )
466+ s += "Specify :okwarning: as an option in the ipython:: block to suppress this message\n "
467+ sys .stdout .write ('\n \n >>>' + ('-' * 73 ))
467468 sys .stdout .write (s )
468- sys .stdout .write ('-' * 76 + '\n ' )
469+ sys .stdout .write ('-' * 76 + '\n ' )
469470 s = warnings .formatwarning (w .message , w .category ,
470471 w .filename , w .lineno , w .line )
471- sys .stdout .write (' \n ' . join ( textwrap . wrap ( s , 80 )) )
472- sys .stdout .write ('\n <<<' + '-' * 73 + '\n ' )
472+ sys .stdout .write (s )
473+ sys .stdout .write ('<<<' + ( '-' * 73 ) + '\n ' )
473474
474475 self .cout .truncate (0 )
475476 return (ret , input_lines , output , is_doctest , decorator , image_file ,
0 commit comments