##// END OF EJS Templates
warn about names clobbered by `%pylab`
MinRK -
Show More
@@ -2865,9 +2865,17 b' class InteractiveShell(SingletonConfigurable):'
2865 % (gui, " ".join(sorted(backends.keys()))))
2865 % (gui, " ".join(sorted(backends.keys()))))
2866 return
2866 return
2867 except ImportError:
2867 except ImportError:
2868 error("pylab mode doesn't work as matplotlib could not be found." + \
2868 error("pylab mode doesn't work as matplotlib or its backend could not be imported." + \
2869 "\nIs it installed on the system?")
2869 "\nIs it installed on the system?")
2870 return
2870 return
2871 # warn about clobbered names
2872 ignored = set(["__builtins__"])
2873 both = set(ns).intersection(self.user_ns).difference(ignored)
2874 clobbered = [ name for name in both if self.user_ns[name] is not ns[name] ]
2875 if clobbered:
2876 warn("pylab import has clobbered these variables: %s"
2877 "\n`%%pylab --no-import` prevents imports from pylab, numpy, etc." % clobbered
2878 )
2871 self.user_ns.update(ns)
2879 self.user_ns.update(ns)
2872 self.user_ns_hidden.update(ns)
2880 self.user_ns_hidden.update(ns)
2873 # Now we must activate the gui pylab wants to use, and fix %run to take
2881 # Now we must activate the gui pylab wants to use, and fix %run to take
General Comments 0
You need to be logged in to leave comments. Login now