##// END OF EJS Templates
Merge pull request #1689 from bfroehle/_1240_ipython_kernel_sys_path...
Min RK -
r6698:ba75fa5b merge
parent child Browse files
Show More
@@ -117,9 +117,10 b' class InteractiveShellApp(Configurable):'
117
117
118 Provides configurables for loading extensions and executing files
118 Provides configurables for loading extensions and executing files
119 as part of configuring a Shell environment.
119 as part of configuring a Shell environment.
120
120
121 Provides init_extensions() and init_code() methods, to be called
121 Provides init_path(), to be called before, and init_extensions() and
122 after init_shell(), which must be implemented by subclasses.
122 init_code() methods, to be called after init_shell(), which must be
123 implemented by subclasses.
123 """
124 """
124 extensions = List(Unicode, config=True,
125 extensions = List(Unicode, config=True,
125 help="A list of dotted module names of IPython extensions to load."
126 help="A list of dotted module names of IPython extensions to load."
@@ -156,6 +157,11 b' class InteractiveShellApp(Configurable):'
156 )
157 )
157 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
158 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
158
159
160 def init_path(self):
161 """Add current working directory, '', to sys.path"""
162 if sys.path[0] != '':
163 sys.path.insert(0, '')
164
159 def init_shell(self):
165 def init_shell(self):
160 raise NotImplementedError("Override in subclasses")
166 raise NotImplementedError("Override in subclasses")
161
167
@@ -314,6 +314,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
314 # print self.extra_args
314 # print self.extra_args
315 if self.extra_args and not self.something_to_run:
315 if self.extra_args and not self.something_to_run:
316 self.file_to_run = self.extra_args[0]
316 self.file_to_run = self.extra_args[0]
317 self.init_path()
317 # create the shell
318 # create the shell
318 self.init_shell()
319 self.init_shell()
319 # and draw the banner
320 # and draw the banner
@@ -325,10 +326,6 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
325
326
326 def init_shell(self):
327 def init_shell(self):
327 """initialize the InteractiveShell instance"""
328 """initialize the InteractiveShell instance"""
328 # I am a little hesitant to put these into InteractiveShell itself.
329 # But that might be the place for them
330 sys.path.insert(0, '')
331
332 # Create an InteractiveShell instance.
329 # Create an InteractiveShell instance.
333 # shell.display_banner should always be False for the terminal
330 # shell.display_banner should always be False for the terminal
334 # based app, because we call shell.show_banner() by hand below
331 # based app, because we call shell.show_banner() by hand below
@@ -597,6 +597,7 b' class IPKernelApp(KernelApp, InteractiveShellApp):'
597 @catch_config_error
597 @catch_config_error
598 def initialize(self, argv=None):
598 def initialize(self, argv=None):
599 super(IPKernelApp, self).initialize(argv)
599 super(IPKernelApp, self).initialize(argv)
600 self.init_path()
600 self.init_shell()
601 self.init_shell()
601 self.init_extensions()
602 self.init_extensions()
602 self.init_code()
603 self.init_code()
General Comments 0
You need to be logged in to leave comments. Login now