JuliaMusic / MusicVisualizations.jl

Providing music-related visualization built on top of the packages of JuliaMusic
MIT License
16 stars 4 forks source link

musescore.jl did not find installed musescore3; error message not shown. #9

Closed jogama closed 3 years ago

jogama commented 3 years ago

Ubuntu 20.04.2 LTS Julia 1.5.2

(@v1.5) pkg> status
Status `~/.julia/environments/v1.5/Project.toml`
  [8f4d0f93] Conda v1.5.1
  [3f0dd361] DefaultApplication v0.1.3
  [274955c0] MusicManipulations v1.6.1
  [8e838768] MusicVisualizations v0.2.4
  [521615e9] MusicXML v0.3.3
  [438e738f] PyCall v1.92.2
$ musescore3 -v  
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.  
MuseScore3 3.2.3

Fixed locally by changing const MUSESCORE = @static Sys.iswindows() ? "MuseScore3" : "mscore" to const MUSESCORE = @static Sys.iswindows() ? "mscore" : "musescore3"

I'm not certain how the text fixture could be updated to catch this, or if this fix breaks windows.

Here's the original errror:

julia> musescore("test.png",notes)
ERROR: 
Stacktrace:
 [1] test_musescore() at /home/jogama/.julia/packages/MusicVisualizations/euoF6/src/musescore.jl:16
 [2] musescore(::String, ::Notes{Note}; display::Bool, rmmidi::Bool, c::Cmd) at /home/jogama/.julia/packages/MusicVisualizations/euoF6/src/musescore.jl:52
 [3] musescore(::String, ::Notes{Note}) at /home/jogama/.julia/packages/MusicVisualizations/euoF6/src/musescore.jl:51
 [4] top-level scope at REPL[6]:1
SYSTEM (REPL): showing an error caused an error
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] getproperty at ./Base.jl:33 [inlined]
 [2] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::SystemError) at ./errorshow.jl:133
 [3] (::Base.var"#689#690"{SystemError})(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at ./errorshow.jl:90
 [4] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}; bold::Bool) at ./util.jl:72
 [5] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}) at ./util.jl:70
 [6] showerror(::IOContext{REPL.Terminals.TTYTerminal}, ::SystemError, ::Array{Base.StackTraces.StackFrame,1}; backtrace::Bool) at ./errorshow.jl:89
 [7] show_exception_stack(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./errorshow.jl:737
 [8] display_error(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./client.jl:104
 [9] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [10] invokelatest at ./essentials.jl:709 [inlined]
 [11] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /home/jogama/code/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:233
 [12] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /home/jogama/code/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [13] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /home/jogama/code/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [14] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [15] invokelatest at ./essentials.jl:709 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/jogama/code/julia/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/jogama/code/julia/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1144
 [18] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

I don't know if the above error message was supposed to show this:

            """
            The command `$(MUSESCORE) -v` did not run, which probably means that
            MuseScore is not accessible from the command line.
            Please first install MuseScore
            on your computer and then add it to your PATH."""
Datseris commented 3 years ago

I only have access to Windows machines, so it is hard to test on other machines :( Why did you change in your source what would happen if your machine was Windows?

jogama commented 3 years ago

My apologies for taking days to reply! This should be an easy issue to resolve. If you're not concerned for me taking an unbounded amount of time, I can take it if you help me test windows.

I guess I misinterpreted the code; I thought the error was that the ternary statement was flipped. Would the correct line then be this

 const MUSESCORE = @static Sys.iswindows() ? "MuseScore3" : "musescore3"

?

Datseris commented 3 years ago

Yeap!

jogama commented 3 years ago

Should I make a separate issue to add a test and send the PR for just this now, or take more time to do it all at once?

Datseris commented 3 years ago

or take more time to do it all at once?

I think I have lost something! I thought we only had to do a small quick fix

 const MUSESCORE = @static Sys.iswindows() ? "MuseScore3" : "musescore3"

?

Datseris commented 3 years ago

Perhaps even better to add a clause for each system:

const MUSESCORE = @static Sys.iswindows() ? "mscore" : Sys.islinux() ? "musescore3" : "mscore3"