A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/1191/ below:

profile/startup files not executed with "notebook" · Issue #1191 · ipython/ipython · GitHub

The new HTML notebook feature in iPython 0.12 doesn't seem to be executing the Python files that are in the "startup" sub-folder of the profile folder I specify.
I'm starting iPython with the following command line (this is on Windows XP by the way):

ipython notebook --ipython-dir iPythonDir

where "iPythonDir is a sub-directory of the current directory which has a "profile_default" sub-directory and a "profile_default/startup" sub-sub-directory.
In the later directory I have a file named "iPythonStartup.ipy" which does a few things, ending with a print statement telling me that it is finished.

If I run ipython without the "notebook" sub-command like this:

ipython --ipython-dir iPythonDir

then my ".ipy" file from the "startup" folder is run as expected.
I know that it is getting executed not only because I see the "Finished ..." output from my print statement,
but (more importantly) because when I evaluate something like: 2 / 3
I get 0.6666 instead of the 0 I would have gotten if it hadn't run the line in my ".ipy" file that does "from future import division".
(I'm using Python 2.7 so division of two integers is truncated integer division by default.)

Here's what I see in the terminal window in that case: (note the "Finished ..." line that was printed from my ".ipy" file)

------
ipython --ipython-dir iPythonDir
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit  
(Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.12 -- 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.
Finished executing code from 'ipythonStartup.ipy'
In [1]: exit
------

But when I use the "notebook" sub-command, I see: (Note that there is no "Finished ..." line in the output)

------
ipython notebook --ipython-dir iPythonDir
[NotebookApp] Using existing profile dir: u'iPythonDir\\profile_default'
[NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888
[NotebookApp] Use Control-C to stop this server and shut down all  
kernels.
^C
------

Note that I know that my ".ipy" file isn't getting executed because
when I evaluate something like: 2 / 3
in the notebook, I get 0
(So I know that the line from __future__ import division from my
".ipy" file wasn't executed.)

As a side note, it isn't entirely clear where the output (stdout) from startup files should be going - should it appear in the terminal window where iPython was started, or should it appear in the notebook(s)?
(But not to be distracted by this question - the bug is that the startup files don't seem to get executed at all. Or is it perhaps that the "profile_default" folder is not used when in "notebook" mode?)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4