Show More
@@ -258,13 +258,17 b' class Demo(object):' | |||||
258 | self.auto_all = auto_all |
|
258 | self.auto_all = auto_all | |
259 | self.src = src |
|
259 | self.src = src | |
260 |
|
260 | |||
261 | self.inside_ipython = "get_ipython" in globals() |
|
261 | try: | |
|
262 | ip = get_ipython() # this is in builtins whenever IPython is running | |||
|
263 | self.inside_ipython = True | |||
|
264 | except NameError: | |||
|
265 | self.inside_ipython = False | |||
|
266 | ||||
262 | if self.inside_ipython: |
|
267 | if self.inside_ipython: | |
263 | # get a few things from ipython. While it's a bit ugly design-wise, |
|
268 | # get a few things from ipython. While it's a bit ugly design-wise, | |
264 | # it ensures that things like color scheme and the like are always in |
|
269 | # it ensures that things like color scheme and the like are always in | |
265 | # sync with the ipython mode being used. This class is only meant to |
|
270 | # sync with the ipython mode being used. This class is only meant to | |
266 | # be used inside ipython anyways, so it's OK. |
|
271 | # be used inside ipython anyways, so it's OK. | |
267 | ip = get_ipython() # this is in builtins whenever IPython is running |
|
|||
268 | self.ip_ns = ip.user_ns |
|
272 | self.ip_ns = ip.user_ns | |
269 | self.ip_colorize = ip.pycolorize |
|
273 | self.ip_colorize = ip.pycolorize | |
270 | self.ip_showtb = ip.showtraceback |
|
274 | self.ip_showtb = ip.showtraceback |
General Comments 0
You need to be logged in to leave comments.
Login now