File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 55import yaml
66from functools import partial
77from collections import defaultdict
8- from itertools import chain , accumulate
8+ from itertools import chain
99import logging
1010from warnings import warn
1111from IPython .core .interactiveshell import ExecutionResult
2323import psyplot .plotter as psyp
2424from psyplot .data import isstring
2525
26+ try :
27+ from IPython .core .interactiveshell import ExecutionInfo
28+ except ImportError :
29+ ExecutionInfo = None
30+
2631
2732logger = logging .getLogger (__name__ )
2833
@@ -539,9 +544,14 @@ def run_code(self):
539544 import psyplot .project as psy
540545 psy .gcp ().update (** {key : yaml .load (text )})
541546 else :
542- e = ExecutionResult ()
543- self .shell .run_code ("psy.gcp().update(%s={'%s': %s})" % (
544- param , key , text ), e )
547+ code = "psy.gcp().update(%s={'%s': %s})" % (param , key , text )
548+ if ExecutionInfo is not None :
549+ info = ExecutionInfo (raw_cell = code , store_history = False ,
550+ silent = True , shell_futures = False )
551+ e = ExecutionResult (info )
552+ else :
553+ e = ExecutionResult ()
554+ self .shell .run_code (code , e )
545555 try :
546556 e .raise_error ()
547557 except Exception : # reset the console and clear the error message
You can’t perform that action at this time.
0 commit comments