ThinkJulia.jl icon indicating copy to clipboard operation
ThinkJulia.jl copied to clipboard

Problem with Chapter 14 Modules in Julia 1.1

Open danpal96 opened this issue 5 years ago • 1 comments

I am using Julia 1.1 in Ubuntu 18.04 and was doing the Exercise 14-1 of the Modules Section in chapter 14.

Executing the code:

include("wc.jl")
using LineCount
linecount("wc.jl")

gives the error:

ArgumentError: Package LineCount not found in current path:
- Run `import Pkg; Pkg.add("LineCount")` to install the LineCount package.


Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:823
 [2] top-level scope at In[1]:2

In https://stackoverflow.com/questions/37200025/how-to-import-custom-module-in-julia says that in >0.7 you should use:

include("wc.jl")
using .LineCount
linecount("wc.jl")

that runs with no problem.

Thanks for your work in this great book, Daniel Palma

danpal96 avatar May 10 '19 01:05 danpal96

Thanks

BenLauwens avatar Apr 07 '20 07:04 BenLauwens