##// END OF EJS Templates
notebook supports raw_input and %debug now...
MinRK -
Show More
@@ -145,10 +145,124 b''
145 "cell_type": "markdown",
145 "cell_type": "markdown",
146 "metadata": {},
146 "metadata": {},
147 "source": [
147 "source": [
148 "The one feature the notebook currently doesn't support as a Frontend is the ability to send data to the Kernel's standard input socket. That is, if the Kernel requires information to be typed interactively by calling the builtin `raw_input` function, the Notebook will be blocked. This happens for example if you run a script that queries interactively for parameters, and very importantly, is how the interactive IPython debugger that activates when you type `%debug` works.\n",
148 "The Notebook has added support for `raw_input` and `%debug`, as of 1.0."
149 "\n",
150 "So, in order to be able to use `%debug` or anything else that requires `raw_input`, you can either use a Terminal Console or Qt Console connected to a Notebook's Kernel as described above.\n"
151 ]
149 ]
150 },
151 {
152 "cell_type": "code",
153 "collapsed": false,
154 "input": [
155 "name = raw_input(\"What is your name? \")\n",
156 "name"
157 ],
158 "language": "python",
159 "metadata": {},
160 "outputs": [
161 {
162 "name": "stdout",
163 "output_type": "stream",
164 "stream": "stdout",
165 "text": [
166 "What is your name? Sir Robin\n"
167 ]
168 },
169 {
170 "metadata": {},
171 "output_type": "pyout",
172 "prompt_number": 1,
173 "text": [
174 "u'Sir Robin'"
175 ]
176 }
177 ],
178 "prompt_number": 1
179 },
180 {
181 "cell_type": "code",
182 "collapsed": false,
183 "input": [
184 "def div(x, y):\n",
185 " return x/y\n",
186 "\n",
187 "div(1,0)"
188 ],
189 "language": "python",
190 "metadata": {},
191 "outputs": [
192 {
193 "ename": "ZeroDivisionError",
194 "evalue": "integer division or modulo by zero",
195 "output_type": "pyerr",
196 "traceback": [
197 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
198 "\u001b[1;32m<ipython-input-2-a5097cc0c0c5>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0mdiv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
199 "\u001b[1;32m<ipython-input-2-a5097cc0c0c5>\u001b[0m in \u001b[0;36mdiv\u001b[1;34m(x, y)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mdiv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mdiv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
200 "\u001b[1;31mZeroDivisionError\u001b[0m: integer division or modulo by zero"
201 ]
202 }
203 ],
204 "prompt_number": 2
205 },
206 {
207 "cell_type": "code",
208 "collapsed": false,
209 "input": [
210 "%debug"
211 ],
212 "language": "python",
213 "metadata": {},
214 "outputs": [
215 {
216 "output_type": "stream",
217 "stream": "stdout",
218 "text": [
219 "> \u001b[1;32m<ipython-input-2-a5097cc0c0c5>\u001b[0m(2)\u001b[0;36mdiv\u001b[1;34m()\u001b[0m\n",
220 "\u001b[1;32m 1 \u001b[1;33m\u001b[1;32mdef\u001b[0m \u001b[0mdiv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
221 "\u001b[0m\u001b[1;32m----> 2 \u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
222 "\u001b[0m\u001b[1;32m 3 \u001b[1;33m\u001b[1;33m\u001b[0m\u001b[0m\n",
223 "\u001b[0m\n"
224 ]
225 },
226 {
227 "name": "stdout",
228 "output_type": "stream",
229 "stream": "stdout",
230 "text": [
231 "ipdb> x\n"
232 ]
233 },
234 {
235 "output_type": "stream",
236 "stream": "stdout",
237 "text": [
238 "1\n"
239 ]
240 },
241 {
242 "name": "stdout",
243 "output_type": "stream",
244 "stream": "stdout",
245 "text": [
246 "ipdb> y\n"
247 ]
248 },
249 {
250 "output_type": "stream",
251 "stream": "stdout",
252 "text": [
253 "0\n"
254 ]
255 },
256 {
257 "name": "stdout",
258 "output_type": "stream",
259 "stream": "stdout",
260 "text": [
261 "ipdb> exit\n"
262 ]
263 }
264 ],
265 "prompt_number": 3
152 }
266 }
153 ],
267 ],
154 "metadata": {}
268 "metadata": {}
General Comments 0
You need to be logged in to leave comments. Login now