windows - Python says pygames has no attribute 'init()' but lib is installed correctly -
i'm using python 2.7
pygame-1.9.2pre.win32-py2.7.exe
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
i've run script:
import pygame print 'pygame version: %s ' % pygame.__version__
to see if module installed correctly , got:
pygame version: 1.9.2pre
as far know, means pygame working correctly. in python idle try run interactively:
import pygame pygame.init() # set height , width of screen size=[700,500] screen=pygame.display.set_mode(size) pygame.display.set_caption("my game")
and works fine. whenever try run script get:
traceback (most recent call last): file "d:\computing\workspaces\python\test\pygame.py", line 5, in <module> import pygame file "d:\computing\workspaces\python\test\pygame.py", line 13, in <module> pygame.init() attributeerror: 'module' object has no attribute 'init'
on eclipse or running in idle either. be?
if script named pygame.py
python import instead of actual pygame
package (when import pygame
). might explain error.
Comments
Post a Comment