2

I have downloaded pygame and installed it. Now i want to write scripts and run them through the QGIS console that implement methods of pygame but when the console reads "import pygame" i get a

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:/Users/stelios/Desktop/project/x.py", line 11, in <module>
    import pygame
  File "C:/PROGRA~1/QGISBR~1/apps/qgis/./python\qgis\utils.py", line 460, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pygame 

Any ideas?

I suppose i have to set something like a path through QGIS options but i dont know exactly.

  • If you're using Windows, you might check if the PYTHONPATH system variable includes the folder where pygame stored. – raykendo Mar 5 '15 at 15:22
  • How have you have installed Pygame and where ? – gene Mar 5 '15 at 16:21
  • @gene I downloaded and run the pygame-1.9.1.win32-py2.7.msi 3.1MB found in the link on my original post. Then i found the pygame folder inside C:/Python27/include and inside C:/Python27/Lib/site-packages – Stelios M Mar 5 '15 at 17:29
  • The problem is that is not the Python version used by QGIS (look at QGIS Standalone and the Python Modules) – gene Mar 5 '15 at 17:35
  • 1
    I believe you. Go ahead and add it as a custom variable, and include the paths for your python files, including the one for pygame. – raykendo Mar 9 '15 at 13:58

Your Answer

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

Browse other questions tagged or ask your own question.