# Trouble with running Julia scripts from within Geany

**URL:** https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519
**Category:** New to Julia
**Tags:** question
**Created:** [June 11, 2024, 9:46pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519 "2024-06-11T21:46:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![oOosys](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ooosys/32/209566_2.png) [@oOosys](https://discourse.julialang.org/u/oOosys)
#### Post date: [June 11, 2024, 9:46pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/1 "2024-06-11T21:46:14Z")

</div>

```julia
 $ /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:

```julia
[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?

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [June 12, 2024, 4:04am UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/2 "2024-06-12T04:04:02Z")

</div>

`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](https://modernjuliaworkflows.github.io/writing/#running_code)

---

<div class="post-metadata">

### Author: ![oOosys](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ooosys/32/209566_2.png) [@oOosys](https://discourse.julialang.org/u/oOosys)
#### Post date: [June 13, 2024, 1:04pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/4 "2024-06-13T13:04:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![maxfreu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxfreu/32/17468_2.png) [@maxfreu](https://discourse.julialang.org/u/maxfreu)
#### Post date: [June 14, 2024, 8:56am UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/5 "2024-06-14T08:56:06Z")

</div>

The [geany documentation](https://wiki.geany.org/howtos/configurebuildmenu) 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.

---

<div class="post-metadata">

### Author: ![oOosys](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ooosys/32/209566_2.png) [@oOosys](https://discourse.julialang.org/u/oOosys)
#### Post date: [June 14, 2024, 1:37pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/6 "2024-06-14T13:37:00Z")

</div>

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:

```julia
[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.**

---

<div class="post-metadata">

### Author: ![maxfreu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxfreu/32/17468_2.png) [@maxfreu](https://discourse.julialang.org/u/maxfreu)
#### Post date: [June 14, 2024, 4:40pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/7 "2024-06-14T16:40:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![oOosys](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ooosys/32/209566_2.png) [@oOosys](https://discourse.julialang.org/u/oOosys)
#### Post date: [June 14, 2024, 4:49pm UTC](https://discourse.julialang.org/t/trouble-with-running-julia-scripts-from-within-geany/115519/8 "2024-06-14T16:49:53Z")

</div>

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.
