Permalink
Browse files

%profile points to application value, not shell value

also add missing shell.profile_dir in ipkernel

closes gh-939
  • Loading branch information...
1 parent 016adad commit 020c172cd168266f3c03938865e3eb1537f62963 @minrk minrk committed Nov 1, 2011
Showing with 11 additions and 4 deletions.
  1. +5 −1 IPython/core/magic.py
  2. +6 −3 IPython/zmq/ipkernel.py
View
@@ -527,7 +527,11 @@ def magic_page(self, parameter_s=''):
def magic_profile(self, parameter_s=''):
"""Print your currently active IPython profile."""
- print self.shell.profile
+ from IPython.core.application import BaseIPythonApplication
+ if BaseIPythonApplication.initialized():
+ print BaseIPythonApplication.instance().profile
+ else:
+ error("profile is an application-level value, but you don't appear to be in an IPython application")
def magic_pinfo(self, parameter_s='', namespaces=None):
"""Provide detailed information about an object.
View
@@ -64,6 +64,7 @@ class Kernel(Configurable):
shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
session = Instance(Session)
+ profile_dir = Instance('IPython.core.profiledir.ProfileDir')
shell_socket = Instance('zmq.Socket')
iopub_socket = Instance('zmq.Socket')
stdin_socket = Instance('zmq.Socket')
@@ -106,7 +107,9 @@ def __init__(self, **kwargs):
atexit.register(self._at_shutdown)
# Initialize the InteractiveShell subclass
- self.shell = ZMQInteractiveShell.instance(config=self.config)
+ self.shell = ZMQInteractiveShell.instance(config=self.config,
+ profile_dir = self.profile_dir,
+ )
self.shell.displayhook.session = self.session
self.shell.displayhook.pub_socket = self.iopub_socket
self.shell.display_pub.session = self.session
@@ -739,16 +742,16 @@ def initialize(self, argv=None):
self.init_code()
def init_kernel(self):
- kernel_factory = Kernel
if self.pylab:
gui, backend = pylabtools.find_gui_and_backend(self.pylab)
- kernel = kernel_factory(config=self.config, session=self.session,
+ kernel = Kernel(config=self.config, session=self.session,
shell_socket=self.shell_socket,
iopub_socket=self.iopub_socket,
stdin_socket=self.stdin_socket,
log=self.log,
+ profile_dir=self.profile_dir,
)
self.kernel = kernel
kernel.record_ports(self.ports)

0 comments on commit 020c172

Please sign in to comment.