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 5
5
import yaml
6
6
from functools import partial
7
7
from collections import defaultdict
8
- from itertools import chain , accumulate
8
+ from itertools import chain
9
9
import logging
10
10
from warnings import warn
11
11
from IPython .core .interactiveshell import ExecutionResult
23
23
import psyplot .plotter as psyp
24
24
from psyplot .data import isstring
25
25
26
+ try :
27
+ from IPython .core .interactiveshell import ExecutionInfo
28
+ except ImportError :
29
+ ExecutionInfo = None
30
+
26
31
27
32
logger = logging .getLogger (__name__ )
28
33
@@ -539,9 +544,14 @@ def run_code(self):
539
544
import psyplot .project as psy
540
545
psy .gcp ().update (** {key : yaml .load (text )})
541
546
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 )
545
555
try :
546
556
e .raise_error ()
547
557
except Exception : # reset the console and clear the error message
You can’t perform that action at this time.
0 commit comments