Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 6th, 2005, 10:37 AM   #1
Gunman
Programmer
 
Gunman's Avatar
 
Join Date: Oct 2005
Posts: 56
Rep Power: 4 Gunman is on a distinguished road
Pygame error

Hey, I downloaded pygame but when I try to import pygame in the python intepreter it gives me the following error:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in -toplevel-
    import pygame
  File "C:/Python24\pygame.py", line 2, in -toplevel-
    from pygame.locals import *
ImportError: No module named locals

Can someone help me with this prob ? Thanks in advance =)
Gunman is offline   Reply With Quote
Old Nov 6th, 2005, 11:03 AM   #2
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

Did you install Pygame? If so, there should be a folder called C:\Python24\Lib\site-packages\pygame on your computer. Pygame is a package, there is no file called pygame.py, just the folder pygame and a file __init__.py in the folder declaring the package. This folder also contains locals.py, the module file you are looking for.

If you have Windows you should have downloaded the installer pygame-1.7.1release.win32-py2.4.exe and executed it.
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Nov 6th, 2005, 11:13 AM   #3
Gunman
Programmer
 
Gunman's Avatar
 
Join Date: Oct 2005
Posts: 56
Rep Power: 4 Gunman is on a distinguished road
When i ran "C:\Python24\Lib\site-packages\pygame " , there are many folders in it but not locals.py .
Gunman is offline   Reply With Quote
Old Nov 6th, 2005, 11:23 AM   #4
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

Hmm, locals.py is a short file that sets up the namespace "locals" for a bunch of pygame constants and functions:
"""Set of functions from PyGame that are handy to have in
the local namespace for your module"""

from pygame.constants import *
from pygame.rect import Rect
import pygame.color as color
Color = color.Color

What is the name of the file you downloaded from the Pygame site?
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Nov 6th, 2005, 11:23 AM   #5
Gunman
Programmer
 
Gunman's Avatar
 
Join Date: Oct 2005
Posts: 56
Rep Power: 4 Gunman is on a distinguished road
pygame-2.7.1release.win32-py2.4
Gunman is offline   Reply With Quote
Old Nov 6th, 2005, 11:30 AM   #6
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

2.7.1?
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Nov 6th, 2005, 11:35 AM   #7
Gunman
Programmer
 
Gunman's Avatar
 
Join Date: Oct 2005
Posts: 56
Rep Power: 4 Gunman is on a distinguished road
Ya , Sane sent me that one , after the one i loaded from pygame.org gave me the same error .
Gunman is offline   Reply With Quote
Old Nov 6th, 2005, 11:55 AM   #8
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

Must be Sane's private connection with Pygame. Are you using Windows XP?
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Old Nov 6th, 2005, 12:02 PM   #9
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Quote:
Originally Posted by Dietrich
Must be Sane's private connection with Pygame. Are you using Windows XP?
huh? What do you mean by that?
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Nov 6th, 2005, 12:45 PM   #10
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

Quote:
Originally Posted by coldDeath
huh? What do you mean by that?
Sane can get .mp3 and .mid sound files to play with pygame. I just get errors even with the latest version (1.7.1).

Hard to believe that pygame1.7.1 for windows and python24 should not install properly. You may want to delete that old pygame folder manually and reinstall!
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:49 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC