• About
  • Contact
  • What People Are Saying

Changing stuff in Geany

Feb29th
2012
4 Comments Written by Daniel Veazey

Geany logoI use Geany for my IDE. It’s pretty good for what I do. I’m no hardcore coder. I just use Python for experimenting and learning.

It had been a little while since I did anything with Python. In fact, the last time I used it was before I installed Arch. I got a little bit of coding fever and wanted to refresh my memory. I was thinking about rewriting my Sudoku solver program, using functions instead of the hot mess that I left it in a few months ago.

But I was running into a little problem. When I would press F5 to run my program, the terminal that popped up gave me this error message:

./geany_run_script.sh: line 5: python: command not found

------------------
(program exited with code: 127)
Press return to continue

“Well that’s no good,” I thought. It turns out that Geany was trying to run Python with the command “python,” which would be fine if “python” were the command it needed to run. But since I am using Arch, “python” is for the bleeding edge Python 3, whereas the more commonly used Python 2.7 is called with “python2.” Since I didn’t want to use Python 3 and didn’t have it installed, I needed to change the command to “python2″ so Geany wouldn’t give me these error messages anymore. Sure, I could just save the program and then open a terminal and type “python2 filename.py,” but that wouldn’t be a good solution because it would be a hassle.

I checked every preference menu I could find in Geany, but I couldn’t find a setting to change what it pointed to for running Python (or any other) programs. Then I looked all over the place for geany_run_script.sh, but I couldn’t find it anywhere, either. I did, however find some configuration files in /usr/share/geany. Particularly, I found /usr/share/geany/filetypes.python. That directory also had filetypes for all the languages that Geany supports. At the very end of filetypes.python were these lines:

[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=python -m py_compile "%f"
run_cmd=python "%f"

Changing that last line took care of the problem:

run_cmd=python2 "%f"

So Geany stopped giving me error messages when I tried to run my Python programs and I was happy.

I still have a long way to go on rewriting my Sudoku solver, but I will post it here when it is updated. Keep an eye out.

Be Sociable, Share!
  • Tweet

Related posts:

  1. Practical programming
  2. Programming with Python
  3. Working on the bike problem with Python
  4. Python, in bitesize chunks
  5. Three free books for learning Python
Linux, Python    arch linux, geany, sudoku
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
← Yurbuds customer service is great
The Monty Hall Problem →

4 Comments

  1. Ben's Gravatar Ben
    March 11, 2012 at 5:07 pm | Permalink

    I’m glad someone decided to blog about a solution to this problem bc I just was having the same one and tried everything I could think before coming across your site.

    Thanks!

  2. Daniel Veazey's Gravatar Daniel Veazey
    March 11, 2012 at 5:23 pm | Permalink

    Thanks, glad I could help.

  3. Matt_M's Gravatar Matt_M
    May 25, 2012 at 4:02 am | Permalink

    Another vote of thanks for this blog post — I was having a similar problem trying use the Haskell interpreter with Geany, and your post pointed me in the right direction (in this case the solution is to set the appropriate line to: run_cmd=ghci “%f”)

  4. Rob's Gravatar Rob
    October 4, 2012 at 12:54 am | Permalink

    Another “Thank You!” from a grateful python newbie.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why you should leave a comment

1. I read all the comments.
2. I reply and answer every question.
3. I always click through to see the sites of commentators.
4. Because you can.
5. You become a participant instead of just an observer.

EvoLve theme by Theme4Press  •  Powered by WordPress Daniel Veazey
Things I find interesting