I have a file called ModuleName.jl
in a local directory. I believe this file contains a valid module:
#!/usr/bin/env julia
module ModuleName
...
end
When trying to load the module julia -e "using ModuleName"
I get:
ERROR: ArgumentError: ModuleName not found in path
in require at ./loading.jl:233
in process_options at ./client.jl:284
in _start at ./client.jl:411
All works right with julia 0.3.11 in the local directory, but it fails with Julia 0.4.0. I use 64bit Ubuntu 14.04. How can I fix this?
currently(v0.4.0), using
doesn't look in the current working directory. but the good news is you can use something like using .ModuleName
to load modules in CWD as long as issue #4600 is implemented(before v0.5.0).
this undocumented change from v0.3 to v0.4 is due to this commit. if you want to make using
behave as it in v0.3. you can change this line to find_in_path(name)
and recompile julia from the modified source code.
In addition to the other suggestions, I have had success by setting the environment variable for the Julia load path (JULIA_LOAD_PATH
) to include the local directory. In other words, running Julia with:
JULIA_LOAD_PATH=. julia
If you are developign some code, this works best for me: create a main.jl
at the root of your package/module folder. it contains
include("your-source.jl")
and maybe also
include("your-tests.jl")
you can then just open a julia session in your console, work on "your-source.jl", and just send this line into the terminal whenever you want to try it out. Once you are done you can add the package onto the load path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With