Include file


#1

Sorry for that stupid question, but I seem unable to get the include() to work called from the REPL. I just use inline:
include(“C:\Users\Diger\Documents\Julia\test_1.jl”)

and it is complaing about
ERROR: could not open file C:\Users\Diger\Documents\Julia\test_1.jl
Stacktrace:
[1] include at .\boot.jl:317 [inlined]
[2] include_relative(::Module, ::String) at .\loading.jl:1044
[3] include(::Module, ::String) at .\sysimg.jl:29
[4] include(::String) at .\client.jl:392
[5] top-level scope at none:0


#2

“\” is the escape character, so, e.g., “\U” means “escape-U”, and not “\U”. To get “\” in a string, you need to type “\\”. It is actually simpler to use the unix-syntax and use forward-slash instead – Julia correctly handles that even on Windows. Thus, type:

include("c:/users/diger/documents/julia/test_1.jl")

#3

I’m actually using double backslash and that always worked, now with 1.0.2 not anymore.

And with forward slash it still doesn’t work.

PS: Actually I managed. The problem apparently was that the file was recognized as a textfile by windows and somehow stayed that way (by symbol and so probably by recognition) even though I added the .jl ending. I created a new file and saved as .jl again and now the symbol changed and so it works. Dunno why this happens now. Never had this issue before.


#4

Perhaps the first file was actually .jl.txt but Windows was doing its silly “hide extensions for known file types” thing?