JuliaInterop / NBInclude.jl

import code from IJulia Jupyter notebooks into Julia programs
Other
118 stars 17 forks source link

Spurious undefined variable error #16

Closed PhilipLoewen closed 3 years ago

PhilipLoewen commented 5 years ago

Consider this attached file (please rename it as "tester.ipynb"): tester.txt.

It has just 2 cells, with 6 lines of code in total. If you open it in Jupyter, it runs fine. But if you try to read it with the following command, you get an error.

@nbinclude("tester.ipynb")

The error says,

UndefVarError: s not defined

Stacktrace:
 [1] top-level scope at C:\Users\loew\loewCloud\CALO\2019-10\tester.ipynb:In[+2]:4
 [2] include_string(::Module, ::String, ::String) at .\loading.jl:1064
 [3] my_include_string(::Module, ::String, ::String, ::Nothing, ::Bool) at C:\Users\loew\.julia\packages\NBInclude\m4rfj\src\NBInclude.jl:29
 [4] #nbinclude#1(::Bool, ::UnitRange{Int64}, ::Regex, ::typeof(identity), ::Bool, ::typeof(nbinclude), ::Module, ::String) at C:\Users\loew\.julia\packages\NBInclude\m4rfj\src\NBInclude.jl:82
 [5] nbinclude(::Module, ::String) at C:\Users\loew\.julia\packages\NBInclude\m4rfj\src\NBInclude.jl:53
 [6] top-level scope at In[2]:1

I have Julia 1.2.0, with IJulia v1.20.0 and NBInclude v2.1.0.

I hope there is enough information here to decide if this is a bug in your package and how to fix it. If the bug is in my understanding/expectations instead, then I will be grateful to learn more. Either way, I have something extra to thank you for ... in addition to this useful module!

PhilipLoewen commented 5 years ago

It's safe to close this. Apparently the solution was user education, which I got over on the Julia Discourse forums. Thanks again.