File tree Expand file tree Collapse file tree 3 files changed +42
-49
lines changed Expand file tree Collapse file tree 3 files changed +42
-49
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ INPUT_DIR="workshops/docs/modules/notebooks"
5
5
OUT_DIR=" workshops/docs/modules"
6
6
TEMPLATE_DIR=" workshops/docs/modules/notebooks/nbconvert_templates"
7
7
8
- # We need to allow errors when executing since there are examples that
9
- # intentionally elicit a traceback.
10
- # TODO: If we move those examples into Markdown cells we can remove
11
- # --allow-errors and better test notebooks at build time
12
- #
8
+ # We allow errors (--allow-errors) when executing to catch and broken examples.
9
+ # Any example that requires printing a traceback should be moved into a
10
+ # Markdown example cell so that code is displayed by not executed.
11
+
13
12
# ggplot/plotnine cells are sometimes slow, so we increase the default timeout
14
- EXECUTE=" --execute --allow-errors --ExecutePreprocessor.timeout=240"
13
+ # EXECUTE="--execute --allow-errors --ExecutePreprocessor.timeout=240"
14
+ EXECUTE=" --execute --ExecutePreprocessor.timeout=240"
15
15
16
16
generate_html=' no'
17
17
generate_instructor_notes=' no'
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ While this works, it's a bad approach for two reasons:
111
111
112
112
113
113
114
+ Running:
114
115
115
116
``` python
116
117
word = ' tin'
@@ -120,29 +121,22 @@ print(word[2])
120
121
print (word[3 ])
121
122
```
122
123
123
- <pre class =" output " >
124
- <div class =" output_label " >output</div >
125
- <code class =" text " >
126
- t
127
- i
128
- n
129
124
130
- </code >
131
- </pre >
132
125
133
126
134
- ---------------------------------------------------------------------------
135
127
136
- IndexError Traceback (most recent call last)
137
-
138
- <ipython-input-3-e59d5eac5430> in <module>()
139
- 3 print(word[1])
140
- 4 print(word[2])
141
- ----> 5 print(word[3])
142
-
143
-
144
- IndexError: string index out of range
128
+ Gives the error:
145
129
130
+ ```
131
+ ---------------------------------------------------------------------------
132
+ IndexError Traceback (most recent call last)
133
+ <ipython-input-4-e59d5eac5430> in <module>()
134
+ 3 print(word[1])
135
+ 4 print(word[2])
136
+ ----> 5 print(word[3])
137
+
138
+ IndexError: string index out of range
139
+ ```
146
140
147
141
148
142
Original file line number Diff line number Diff line change 109
109
]
110
110
},
111
111
{
112
- "cell_type" : " code" ,
113
- "execution_count" : 4 ,
112
+ "cell_type" : " markdown" ,
114
113
"metadata" : {},
115
- "outputs" : [
116
- {
117
- "name" : " stdout" ,
118
- "output_type" : " stream" ,
119
- "text" : [
120
- " t\n " ,
121
- " i\n " ,
122
- " n\n "
123
- ]
124
- },
125
- {
126
- "ename" : " IndexError" ,
127
- "evalue" : " string index out of range" ,
128
- "output_type" : " error" ,
129
- "traceback" : [
130
- " \u001b [0;31m---------------------------------------------------------------------------\u001b [0m" ,
131
- " \u001b [0;31mIndexError\u001b [0m Traceback (most recent call last)" ,
132
- " \u001b [0;32m<ipython-input-4-e59d5eac5430>\u001b [0m in \u001b [0;36m<module>\u001b [0;34m()\u001b [0m\n \u001b [1;32m 3\u001b [0m \u001b [0mprint\u001b [0m\u001b [0;34m(\u001b [0m\u001b [0mword\u001b [0m\u001b [0;34m[\u001b [0m\u001b [0;36m1\u001b [0m\u001b [0;34m]\u001b [0m\u001b [0;34m)\u001b [0m\u001b [0;34m\u001b [0m\u001b [0m\n \u001b [1;32m 4\u001b [0m \u001b [0mprint\u001b [0m\u001b [0;34m(\u001b [0m\u001b [0mword\u001b [0m\u001b [0;34m[\u001b [0m\u001b [0;36m2\u001b [0m\u001b [0;34m]\u001b [0m\u001b [0;34m)\u001b [0m\u001b [0;34m\u001b [0m\u001b [0m\n \u001b [0;32m----> 5\u001b [0;31m \u001b [0mprint\u001b [0m\u001b [0;34m(\u001b [0m\u001b [0mword\u001b [0m\u001b [0;34m[\u001b [0m\u001b [0;36m3\u001b [0m\u001b [0;34m]\u001b [0m\u001b [0;34m)\u001b [0m\u001b [0;34m\u001b [0m\u001b [0m\n \u001b [0m" ,
133
- " \u001b [0;31mIndexError\u001b [0m: string index out of range"
134
- ]
135
- }
136
- ],
137
114
"source" : [
115
+ " Running:\n " ,
116
+ " \n " ,
117
+ " ```python\n " ,
138
118
" word = 'tin'\n " ,
139
119
" print(word[0])\n " ,
140
120
" print(word[1])\n " ,
141
121
" print(word[2])\n " ,
142
- " print(word[3])"
122
+ " print(word[3])\n " ,
123
+ " ```"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type" : " markdown" ,
128
+ "metadata" : {},
129
+ "source" : [
130
+ " Gives the error:\n " ,
131
+ " \n " ,
132
+ " ```\n " ,
133
+ " ---------------------------------------------------------------------------\n " ,
134
+ " IndexError Traceback (most recent call last)\n " ,
135
+ " <ipython-input-4-e59d5eac5430> in <module>()\n " ,
136
+ " 3 print(word[1])\n " ,
137
+ " 4 print(word[2])\n " ,
138
+ " ----> 5 print(word[3])\n " ,
139
+ " \n " ,
140
+ " IndexError: string index out of range\n " ,
141
+ " ```"
143
142
]
144
143
},
145
144
{
You can’t perform that action at this time.
0 commit comments