##// END OF EJS Templates
fix ipython-qtconsole when run as a GUI script
Min RK -
Show More
@@ -161,6 +161,11 b' class Application(SingletonConfigurable):'
161 161 """
162 162 self.log = logging.getLogger(self.__class__.__name__)
163 163 self.log.setLevel(self.log_level)
164 if sys.executable.endswith('pythonw.exe'):
165 # this should really go to a file, but file-logging is only
166 # hooked up in parallel applications
167 self._log_handler = logging.StreamHandler(open(os.devnull, 'w'))
168 else:
164 169 self._log_handler = logging.StreamHandler()
165 170 self._log_formatter = logging.Formatter("[%(name)s] %(message)s")
166 171 self._log_handler.setFormatter(self._log_formatter)
@@ -166,9 +166,8 b' class KernelApp(BaseIPythonApplication):'
166 166 """create our session object"""
167 167 self.session = Session(config=self.config, username=u'kernel')
168 168
169 def init_io(self):
170 """redirects stdout/stderr, and installs a display hook"""
171 # Re-direct stdout/stderr, if necessary.
169 def init_blackhole(self):
170 """redirects stdout/stderr to devnull if necessary"""
172 171 if self.no_stdout or self.no_stderr:
173 172 blackhole = file(os.devnull, 'w')
174 173 if self.no_stdout:
@@ -176,8 +175,8 b' class KernelApp(BaseIPythonApplication):'
176 175 if self.no_stderr:
177 176 sys.stderr = sys.__stderr__ = blackhole
178 177
179 # Redirect input streams and set a display hook.
180
178 def init_io(self):
179 """Redirect input streams and set a display hook."""
181 180 if self.outstream_class:
182 181 outstream_factory = import_item(str(self.outstream_class))
183 182 sys.stdout = outstream_factory(self.session, self.iopub_socket, u'stdout')
@@ -199,6 +198,7 b' class KernelApp(BaseIPythonApplication):'
199 198
200 199 def initialize(self, argv=None):
201 200 super(KernelApp, self).initialize(argv)
201 self.init_blackhole()
202 202 self.init_session()
203 203 self.init_poller()
204 204 self.init_sockets()
General Comments 0
You need to be logged in to leave comments. Login now