ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

gcal.ipynb "collapsed": false, (line 12) doesn't run #537

Closed chris-english closed 10 years ago

chris-english commented 10 years ago

changing "collapsed": false, to "collapsed": "false", line 12 on my editor allows the notebook to load.

jbednar commented 10 years ago

Thanks for the feedback! Can you provide your IPython version? We haven't been able to replicate this problem in the versions we're using.

chris-english commented 10 years ago

brain@neurodebian:~$ ipython --version 0.13.1

but immaterial if I simply am doing something stupid:

brain@neurodebian:~/Documents/Topographica/examples$ ipython gcal.ipynb

NameError Traceback (most recent call last) /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, where) 176 else: 177 filename = fname --> 178 builtin.execfile(filename, where)

/home/brain/Documents/Topographica/examples/gcal.ipynb in () 10 { 11 "cell_type": "code", ---> 12 "collapsed": false, 13 "input": [ 14 "\"\"\"\n",

NameError: name 'false' is not defined

Would probably help to put 'notebook' after ipython, but false without double quotes looked something like an ill-formed xml doc, everything else being in quotes, seemingly. Fixing the double quotes results in the following, though still doesn't start a ipython notebook session: Nor ipython for that matter.

brain@neurodebian:~/Documents/Topographica/examples$ ipython gcal.ipynb brain@neurodebian:~/Documents/Topographica/examples$

I imagine i fixed the double quotes and then entered the proper $ ipython notebook gcal.ipynb without noticing and imagined I'd found a bug.

So, feeling foolish, I'd ask you to close this out.

jbednar commented 10 years ago

We're using IPython versions 1.0 and 1.1, but I think 0.13 should work as well. For what it's worth, the notebook format is JSON, not XML, and false is the right way to write a Boolean in JSON. But the real problem here is that "ipython gcal.ipynb" will try to execute the notebook as Python code, not XML or JSON, and false is indeed not defined in Python.

To get it to work, first make sure that you have downloaded the very latest version of Topographica, using "git pull; git submodule update" after following the installation instructions at github.com/ioam/topographica. Then change to the directory where the .ipynb file is located, and run "topographica -n" to launch the notebook server:

cd topographica/models/stevens.jn13 ../../topographica -n

You'll see a message like "The IPython Notebook is running at: http://127.0.0.1:8889/". You can then open your web browser, navigate to that URL, and select the notebook you want.

I'll open another issue in a moment for your other questions.

MartinThoma commented 9 years ago

I just had exactly the same problem. It was easy to fix:

jbednar commented 9 years ago

That's right -- ipython can't run .ipynb files, but "ipython notebook" can. It would be very convenient if you could run a notebook just by doing "ipython file.ipynb"; which would be a feature request that you could submit to the ipython folks! I personally think notebooks should be runnable from the commandline, but doing so is currently not terribly easy.