Trouble with running Julia scripts from within Geany

 $ /bin/sh /tmp/geany_run_script_PDOCP2.sh
/tmp/geany_run_script_PDOCP2.sh: 7: ./delMe: not found

delMe.jl is the script file and I have updated the filetypes.julia file with:

[build-menu]
run_cmd=/home/o/.juliaup/bin/julialauncher  "%f"
EX_00_CM=/home/o/.juliaup/bin/julialauncher "%f"

but still getting the error … Any idea how to fix it?

julialauncher is the wrong executable I think. Try using just julia.
Amd also be aware that running small scripts repeatedly is not an efficient way of using Julia due to the rather slow startup and the repeated compilation. Have look at
https://modernjuliaworkflows.github.io/writing/#running_code

Interesting … if I create a file with .jl.jl as extension, the x.jl will be run if I press F5 to run x.jl.jl … so somehow the .jl extension is removed from the passed file name …
Changing the start executable to julia results in same behavior as with the launcher.

The geany documentation says:

  • %f - replaced by the filename of the file selected in the editor when the menu item is selected.

  • %e - replaced by the same filename but without the last extension.

  • %d - replaced by the absolute path of the directory of the file selected in the editor when the menu item is selected.

  • %p - replaced by the absolute path of the base directory of the currently open project.

This works for me: julia --project=%p %d/%f You can also set the command under build → set build commands.
Set a name for the menu entry and then you can run it with the respective hotkey.

I also love geany, but for julia I’m using vscode, because it has better integration with julia. So I’d recommend that over geany.

The solution was to use the GUI part of Geany to write entries to the “filetypes.julia” file which produced following ones solving the issue:

[build-menu]
## Use the Geany MENU:	» Build		» Set Build Commands 
# 		to configure the	filetypes.julia	file
# %f will be replaced by the complete filename, %e by the filename without extension
#		(use only one of it at one time)
EX_00_CM=julia %f
EX_00_LB=_Execute
EX_00_WD=

OK … I don’t understand why this works and the previous didn’t, but … the problem is solved and I can be happy to be able to use Geany to run Julia script files, so … I will mark this as the solution. If someone may explain in detail what was the reason for the strange behavior I have observed in first place and how the above solved the problem it would be highly appreciated.

I assume that your build file entries were just wrong and that geany fell back to some default runscript.sh. That in turn tried to run your file with %e, like it would execute main after compiling main.c. Just a handwaving guess.

1 Like

You can see it yourself from what has changed compared to the reference which didn’t work. The file entries were all OK, but … not enough of them (the remaining part of the deduction chain seems to be correct). And yes … using julia as executable name or the other executable path does not matter and both are OK.