File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -244,13 +244,21 @@ def update_mp(self, project):
244244 """Update the `mp` variable in the shell is
245245 ``rcParams['console.auto_set_mp']`` with a main project"""
246246 if self .rc ["auto_set_mp" ] and project is not None and project .is_main :
247- self .run_command_in_shell ("mp = psy.gcp(True)" )
247+ try :
248+ self .run_command_in_shell ("mp = psy.gcp(True)" )
249+ except RuntimeError :
250+ # probably running a script that via IPythons `run` magick
251+ pass
248252
249253 def update_sp (self , project ):
250254 """Update the `sp` variable in the shell is
251255 ``rcParams['console.auto_set_sp']`` with a sub project"""
252256 if self .rc ["auto_set_sp" ] and (project is None or not project .is_main ):
253- self .run_command_in_shell ("sp = psy.gcp()" )
257+ try :
258+ self .run_command_in_shell ("sp = psy.gcp()" )
259+ except RuntimeError :
260+ # probably running a script that via IPythons `run` magick
261+ pass
254262
255263 def show_current_help (self , to_end = False , force = False ):
256264 """Show the help of the object at the cursor position if
You can’t perform that action at this time.
0 commit comments