By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,836 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,836 IT Pros & Developers. It's quick & easy.

Problem with Pygame

kaarthikeyapreyan
100+
P: 107
I have installed pygame v 1.8.0
The installation was sucessful, but the optional packages were not included like the font,movie etc
When i was trying to run the sample script that was given it showed me this error
Expand|Select|Wrap|Line Numbers
  1. $python fonty.py
  2. fonty.py:33: RuntimeWarning: use font: No module named font
  3.   font = pygame.font.Font(None, 80)
  4. Traceback (most recent call last):
  5.   File "fonty.py", line 89, in <module>
  6.     if __name__ == '__main__': main()
  7.   File "fonty.py", line 33, in main
  8.     font = pygame.font.Font(None, 80)
  9.   File "/home/numenta/Python-2.5.2/pythonconf/lib/python2.5/site-packages/pygame /__init__.py", line 52, in __getattr__
  10.     raise NotImplementedError, MissingPygameModule
  11. NotImplementedError: font module not available
And also

Expand|Select|Wrap|Line Numbers
  1. $python arraydemo.py
  2. Traceback (most recent call last):
  3.   File "arraydemo.py", line 13, in <module>
  4.     raise ImportError, 'Error Importing Pygame/surfarray or Numeric'
  5. ImportError: Error Importing Pygame/surfarray or Numeric
  6.  
  7.  
from where can i get these optional packages downloaded or do i have to set anything for before i get pygame installed to have the optional packages included
May 28 '08 #1
Share this Question
Share on Google+
4 Replies


jlm699
100+
P: 314
For surfarray you will need Numeric, which has a link from the pygame download page.

I'm not sure about the "optional" font package. My 1.8.0 release installation has it I just need to do
Expand|Select|Wrap|Line Numbers
  1. import pygame
  2. import pygame.font
So perhaps try reinstalling it and seeing if you get it then.
May 28 '08 #2

kaarthikeyapreyan
100+
P: 107
This is what happened when imported the font module

Expand|Select|Wrap|Line Numbers
  1. >>> import pygame
  2. >>> import pygame.font
  3. Traceback (most recent call last):
  4.   File "<stdin>", line 1, in <module>
  5. ImportError: No module named font
The init file of pygame states that font is an optional package
and requests it to throw am not implemented error when called for it.
I wanted to know how i could include these files that are part of the font module, where are they found cause they were not downloaded as a part of my source
The pygame mod has an entry for the font module i.e dir(pygame)
but the init and the related files for the font module cannot be found
The size of the download was right (was not able to get hold of the md5)
May 29 '08 #3

jlm699
100+
P: 314
dir(pygame) will show an entry font whether you have it or not. This is because the developers have placed a placeholder variable with the value of None when the package is not installed. This way, you can check if pygame.font == None before importing. What system did you install this on? I see that you have dual boots and I have a feeling this is on your non-windows box that you're experiencing problems... I'm wondering if you would be willing to simply install the windows package and see how that works for you.
If not I'm afraid I'm not very adept at installing packages on *nix boxen so I don't know how you would be able to look-up the install options when building the packages.
May 29 '08 #4

kaarthikeyapreyan
100+
P: 107
:)
Thats true am working on a linux box(SLES)
I was not able to get hold of the build option for the optional packages when i built it from the source in my machine
anyway thanks a lot dude ...
Jun 2 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.