Uh, it looks like the three backquotes before and after is the trick to get block quotes; is there any docs on using this site? Anyways, now that block quotes are working, here is my ~/.julia/config/startup.jl
import Pkg
println("In ~/.julia/config/startup.jl")
let
pkgs = ["Revise", "Debugger", "PyPlot", "BenchmarkTools", "Random", "PyCall",
"Statistics", "MAT", "Printf", "Random"]
for pkg in pkgs
if Base.find_package(pkg) === nothing
Pkg.add(pkg)
end
end
end
using Debugger, PyPlot, Printf
try
using Revise
catch e
@warn "Error initializing Revise" exception=(e, catch_backtrace())
end
print("\nHello, startup.jl from ~/.julia/config has just been run\n")
println("Setup successful")
HI,
-
if you compare lines 3 and 4 in your startup – the difference is exactly that line 3 has quote marks ( “
and ”
) as opposed to line 4 which has “poor mans quotes” or in other words the “inch” character as limiters for a string. Line 3 might have been changed by an advanced text editor, but is no longer right Julia code, since “...”
is not how to delimit a string "..."
is.
-
Concerning the three backticks – that is not a quote/blockquote but a code environment, i.e. all stuff between that is set as code (the same for single backticks in running text like `code`
is set as code
. A block quote would need all lines prepended with a >
so (yay we can illustrate code env directly)
> I am a
> blockquote
renders as
I am a
block quote
(but note that this does not look like code – and for code lines you want them to look like code)
But for code you are actually looking for the three backticks code-environment. This is indeed unrelated to Julia and more the discourse forum markup, I found an overview at Discourse Guide: Code Formatting - Meta - Stonehearth Discourse
-
Concnering the order. All I could find anywhere was the location ~/.julia/config/startup.jl
. But it might be (have not found that yet) that your first file takes priority over the local one? Since that only contains a line calling the local one you could try to rename/remove the global one (your first) one and then check whether it runs you local one?
edit: You could try this command How do I open and edit my startup.jl file? - #3 by ianshmean and see which file opens?
edit2: Did you by any chance set the JULIA_DEPOT_PATH
? See https://docs.julialang.org/en/v1/manual/command-line-options/ the startup-file
command line option, if that is not set it should load your local one.
2 Likes
There should be a preview button, as is common for markdown formatted forums.
2 Likes
But line 3:
# include(“/home/martin/.julia/config/startup.jl”)
Is a comment line so the quotes in it should have no effect? Re not running startup.jl: kellertuer, thank you for your excellent suggestions and help, and the time it took you to reply. The problem was JULIA_DEPOT_PATH was set, and it turns out only the first entry of DEPOT_PATH is checked to see if it contains a startup.jl file. This is not mentioned in the documentation re JULIA_DEPOT_PATH. For example:
julia> DEPOT_PATH
4-element Vector{String}:
"/home/Dropbox/programming/julia/JuliaFiles/"
"/home/martin/.julia"
"/home/Dropbox/Julia/julia-1.8.5/local/share/julia"
"/home/Dropbox/Julia/julia-1.8.5/share/julia"
~/.julia/config/startup.jl is not run, but:
julia> DEPOT_PATH
3-element Vector{String}:
"/home/martin/.julia"
"/home/Dropbox/Julia/julia-1.8.5/local/share/julia"
"/home/Dropbox/Julia/julia-1.8.5/share/julia"
julia>
~/.julia/config/startup.jl is run. I think this is a place where the documentation can be improved. I still can’t find the “preview” link which could also help. Still, I now understand how to start julia, and can go on to understanding how to run it, such as why:
includet("SimCirc.jl")
gives an error on the @printf macro, but if I do:
include("SimCirc.jl")
includet("SimCirc.jl")
I don’t get the error; but that’s a topic for another day. I sincerely thank everyone for the help on getting startup.jl to run; topic closed.
1 Like
If you type ? DEPOT_PATH
in REPL or take a look at Constants · The Julia Language
it specifically mentions
The first entry is the “user depot” and should be writable by and owned by the current user. The user depot is where: registries are cloned, new package versions are installed, named environments are created and updated, package repos are cloned, newly compiled package image files are saved, log files are written, development packages are checked out by default, and global configuration data is saved. Later entries in the depot path are treated as read-only and are appropriate for registries, packages, etc. installed and managed by system administrators.
the importance and role of the first folder over the second and all following ones.
For your preview question – When I type my answers here I have an editor window on the left and to the right of that a preview (well now its hidden behind the “this topic has been answered” message that you can close.
For the further problems – let’s maybe not turn this into “The thread that answers quite a few questions.” – that is a question for another day but maybe even more for another thread/topic here on Discourse. Also because I have no clue what your SimCirc.jl
contains.
2 Likes