@less broken?

@less write(stdout,'a') is resulting in the following error

ERROR: could not find source file for function
Stacktrace:
[1] less(::Nothing, ::Int32) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/InteractiveUtils/src/editless.jl:265
[2] less(::Function, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/InteractiveUtils/src/editless.jl:264
[3] top-level scope at REPL[17]:1
[4] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

That was taken from my history, so I know it’s worked in the past. I’ve also tried several others, they all fail with the same error.

If you typed literally

@less write(stdout,‘a’)

those are the wrong quotation marks: you should use the single straight quotation mark ' for characters:

@less write(stdout, 'a')

(but I get a different error message with instead of ')

1 Like

No, that’s just the formatting the forums are apply.

I edited my opening post for clarity.

What does @which write(stdout, 'a') show? Or methods(write)? Or probably more clearly, just displaying write itself? I’m guessing you are shadowing it.

1 Like

The problem isn’t with write, if that’s what you’re getting at. @less isn’t working for any function. As for the output, it’s as expected.

Ah, true, it looks like you may have moved/deleted some files within your Julia install? That error message would pop up if you don’t have the source files.

If they’ve been moved or deleted, then it was without my knowledge.

Looking at $ ls /usr/share/julia/stdlib/v1.5/**|grep jl|uniq, it certainly seems like the source code is there.

Is that where joinpath(Sys.BINDIR, Base.DATAROOTDIR) points? Is there a file at joinpath(Sys.BINDIR, Base.DATAROOTDIR,"julia","base","io.jl")?

julia> joinpath(Sys.BINDIR, Base.DATAROOTDIR)
"/usr/bin/../../build/julia/src/julia-1.5.3/julia-1.5.3/share"

isfile(joinpath(Sys.BINDIR, Base.DATAROOTDIR,"julia","base","io.jl"))
false

isdir(joinpath(Sys.BINDIR, Base.DATAROOTDIR))
false

That would be a “no”.

I’m no expert (or even competent), but I think there is something wrong with Base.DATAROOTDIR.

How did you install Julia? Did you use a distro installation?