Maybe this is a bug report. Please advise.
I have a small notebook that runs perfectly when I open it in Jupyter, but not at the REPL.
Working at a freshly-started Julia 1.2.0 REPL, when I say
using NBInclude
@nbinclude("CALO-MWE.ipynb")
I expect the minimalist workbook attached here to run successfully and print the computed result, but instead I get the error message below:
ERROR: LoadError: UndefVarError: slacksum not defined
Stacktrace:
[1] top-level scope at /home/loew/loewCloud/CALO/2019-10/CALO-MWE.ipynb:In[2]:4
[2] include_string(::Module, ::String, ::String) at ./loading.jl:1064
[3] my_include_string(::Module, ::String, ::String, ::Nothing, ::Bool) at /home/loew/.julia/packages/NBInclude/m4rfj/src/NBInclude.jl:29
[4] #nbinclude#1(::Bool, ::UnitRange{Int64}, ::Regex, ::typeof(identity), ::Bool, ::typeof(nbinclude), ::Module, ::String) at /home/loew/.julia/packages/NBInclude/m4rfj/src/NBInclude.jl:82
[5] nbinclude(::Module, ::String) at /home/loew/.julia/packages/NBInclude/m4rfj/src/NBInclude.jl:53
[6] top-level scope at REPL[14]:1
in expression starting at /home/loew/loewCloud/CALO/2019-10/CALO-MWE.ipynb:In[2]:3
I have Julia 1.2.0, with IJulia v1.20.0 and NBInclude v2.1.0.
What do you suggest?
Sorry, new here, don’t know how to attach the file named CALO-MWE.ipynb, so I’ll just paste it here:
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"slacks = [1,2];"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Total slack: 3.\n"
]
}
],
"source": [
"slacksum = 0;\n",
"\n",
"for sl in slacks\n",
" slacksum += sl\n",
"end\n",
"println(\"\\nTotal slack: $(slacksum).\")"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Julia 1.2.0",
"language": "julia",
"name": "julia-1.2"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.2.0"
}
},
"nbformat": 4,
"nbformat_minor": 1
}