Skip to content

Instantly share code, notes, and snippets.

@markusbaden
Created April 21, 2013 09:49
Show Gist options
  • Save markusbaden/5429112 to your computer and use it in GitHub Desktop.
Save markusbaden/5429112 to your computer and use it in GitHub Desktop.
Verify that PR 3203 solves problem with file cell magic
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "file magic bug"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%file no_blank.txt\n",
"line 1\n",
"line 2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Overwriting no_blank.txt\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!cat no_blank.txt"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"line 1\r\n",
"line 2"
]
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%file with_blank.txt\n",
"line 1\n",
"\n",
"line 2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Overwriting with_blank.txt\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!cat with_blank.txt"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"line 1\r\n",
"\r\n",
"line 2"
]
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%file py_with_blank.py\n",
"print 'spam'\n",
"\n",
"print 'ham'"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Overwriting py_with_blank.py\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!cat py_with_blank.py"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"print 'spam'\r\n",
"\r\n",
"print 'ham'"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For reference, I use the development version of IPython with PR 3203 on top of that"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import IPython\n",
"import os\n",
"install_dir = os.path.split(IPython.__file__)[0]\n",
"cwd = %pwd\n",
"%cd -q $install_dir\n",
"!git branch\n",
"%cd -q $cwd"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" help\r\n",
" master\r\n",
"* pr/3203\r\n"
]
}
],
"prompt_number": 7
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment