O'Reilly Forums: Chapter 7 - No Module Name Found - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 7 - No Module Name Found

#1 User is offline   Breadman200 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 16-March 13

Posted 16 March 2013 - 04:01 PM

Help - I give up - when I try to run the following code I get this message - thanks in advance for any information you can provide.

Traceback (most recent call last):
File "C:/Head First Programming/pySounds.py", line 1, in <module>
import pygame.mixer
ImportError: No module named 'pygame'

I made sure the python program is in the same directory as the pygame folder - I checked and the file mixer.h is in the pygame folder so I am not sure why it is not found. Is there something that I must do since this is a .h file?

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================

Here is the code from page 221 in the Head First Programming book:


import pygame.mixer
# from pygame import mixer
sounds = pygame.mixer
sounds.init()


def wait_finish(channel):
while channel.get_busy():
pass
s = sounds.Sound("heartbeat.wav")
wait_finish(s.play())
s2 = sounds.Sound("buzz.wav")
wait_finish(s2.play())
s3 = sounds.Sound("ohno.wav")
wait_finish(s3.play())
s4 = sounds.Sound("carhorn.wav")
wait_finish(s4.play())
0

#2 User is offline   paulbarry 

  • Advanced Member
  • PipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 257
  • Joined: 20-August 09

Posted 17 March 2013 - 04:21 AM

Have you installed PyGame? See: http://programming.i....ie/pygame.html

--Paul.
0

#3 User is offline   #TM# 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 10-December 12

Posted 18 March 2013 - 12:58 AM



Mr. Paul is right. You have not installed pygame yet.

It seems from your error that you are working on windows.

If you are working on windows 7, you can go to below link for help

the forum link for pygame

In the above link, it is explained how to install pygame for python 3.x in windows 7.

see if works for you !!
B) :)

This post has been edited by #TM#: 18 March 2013 - 01:03 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users