-1

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

2
  • pygame is not pygane - perhaps that's an additional issue.
    – gertvdijk
    Oct 6, 2013 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, 2013 at 11:16

2 Answers 2

2

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.

0

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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .