jolin-io / JuliaScript.jl

finally fast julia scripts
MIT License
79 stars 1 forks source link

BoundsError: attempt to access 0-element Vector{String} at index [1] #7

Open mchitre opened 2 months ago

mchitre commented 2 months ago

A simple script yyy.jl that just prints fails using juliascript:

~> cat yyy.jl
println("xxx")

~> julia yyy.jl
xxx

~> juliascript yyy.jl
ERROR: BoundsError: attempt to access 0-element Vector{String} at index [1]
Stacktrace:
 [1] getindex
   @ ./essentials.jl:13 [inlined]
 [2] prefix_lines(prefix::String, script_content::String; skip_first::Bool)
   @ JuliaScript.Helpers ~/.julia/packages/JuliaScript/KBGYf/src/Helpers.jl:106
 [3] prefix_lines
   @ ~/.julia/packages/JuliaScript/KBGYf/src/Helpers.jl:102 [inlined]
 [4] create_script_package(; script_path::String, script_content::String, cache_name::String, cache_path::String, rest::@Kwargs{})
   @ JuliaScript ~/.julia/packages/JuliaScript/KBGYf/src/JuliaScript.jl:92
 [5] create_script_package
   @ ~/.julia/packages/JuliaScript/KBGYf/src/JuliaScript.jl:76 [inlined]
 [6] run_script(script_path::String, commandline_args::Vector{String})
   @ JuliaScript ~/.julia/packages/JuliaScript/KBGYf/src/JuliaScript.jl:57
 [7] julia_main()
   @ JuliaScript ~/.julia/packages/JuliaScript/KBGYf/src/JuliaScript.jl:37
 [8] top-level scope
   @ none:1

Other issues in getting started

It might be worthwhile to improve documentation to help with the following issues I faced in getting started:

  1. I am on a MAC OS X. It didn't have sha256sum, which had to be installed. The documentation perhaps needs information on this. Also the installation instruction about downloading didn't work for me, as the juliaup installation directory assumption is not valid on all systems.
  2. It is unclear as to how a script is supposed to depend on packages, if it needs more than a standard library.