whenever i make a program on geany and with python and use the pygame module and run it it returns with an error: Traceback (most recent call last): File "clock.py", line 1, in import time,pygane ImportError: No module named pygane

i heard that if you run python 2.7.3 on geany it recognizes the pygame module

  • pygame is not pygane - perhaps that's an additional issue. – gertvdijk Oct 6 '13 at 10:59
  • Did you configure geany to run python scripts? Did enable the universe repository? Did you install sudo apt-get install python-pygame? – MadMike Oct 7 '13 at 11:16

Either configure Geany inside build menu -> Set build commands hard to use Python 2.7 by choosing python2 (is this supported by Ubuntu?) or adjust your shebang of your Python files.


As far as I know, Geany by default uses Python 3 to run the Python codes. So in order to run Python 2 codes, do the following.

Step 1: Go to Build -> Set build commands in the menu bar (screenshot attached below).

Build -> Set Build Commands

Step 2: You would get a "Set Build Commands" window like this:

Set Build Commands window

You can clearly see the "Compile" and "Execute" build commands as python3 -m py_compile "%f" and python3 "%f" respectively.

Step 3: In both of these commands, change python3 to python and you are good to go. Doing this directs Geany to call python instead of python3:

New Build Commands

And make sure before doing all these, save the code with a .py extension!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.