Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sys.path missing '' as first entry in ipython kernel. #1689

Merged
merged 2 commits into from May 3, 2012

Conversation

bfroehle
Copy link
Contributor

@bfroehle bfroehle commented May 2, 2012

The comment is copied from the corresponding code in TerminalIPythonApp.

Closes #1240.

As Min suggests in #1240, we should consider gathering up all of these lines and putting them into InteractiveShell (or InteractiveShellApp?) instead.

To test:

$ ipython kernel &
[1] 10069
$ ipython console --existing kernel-10035.json
Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.dev -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sys

In [2]: sys.path[0]
Out[2]: ''

The comment is copied from the corresponding code in TerminalIPythonApp.

Closes ipython#1240.
@minrk
Copy link
Member

minrk commented May 2, 2012

Can you put it in InteractiveShellApp? That way possible new entry points will inherit this properly.

@bfroehle
Copy link
Contributor Author

bfroehle commented May 2, 2012

Yes, I considered that, however it wasn't really clear where it would belong. I'll look again when I get a chance.

@minrk
Copy link
Member

minrk commented May 2, 2012

If nowhere seems obvious, just add a separate init_path() step with this one line, and call it from initialize().

@bfroehle
Copy link
Contributor Author

bfroehle commented May 3, 2012

Tested to have the desired behavior (sys.path[0] == '' and sys.path[1] != '') in:

  • ipython
  • ipython console
  • ipython qtconsole
  • ipython notebook
  • ipython kernel + ipython console --existing <...>

@minrk
Copy link
Member

minrk commented May 3, 2012

Terrific, thanks! I'll go ahead and merge.

minrk added a commit that referenced this pull request May 3, 2012
Fix sys.path missing '' as first entry in `ipython kernel`.

Adds init_path to InteractiveShellApp, to avoid future entry points having the same omission.

closes #1240
@minrk minrk merged commit ba75fa5 into ipython:master May 3, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
…s_path

Fix sys.path missing '' as first entry in `ipython kernel`.

Adds init_path to InteractiveShellApp, to avoid future entry points having the same omission.

closes ipython#1240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sys.path missing '' as first entry when kernel launched without interface
2 participants