Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
well i downloaded all of the stuff needed for pygame. i was reading this tutorial on their site and it game me this code:


import pygame ,sys, os
from pygame.locals import *

pygame.init( )

pygame.display.set_caption('Monkey Fever')
screen=pygame.display.get_surface( )



screen.blit(monkey_surface, (0,0))
pygame.display.flip( )

def input(events):
    for event in events:
        if event.type==QUIT:
            print event

while True:

but when i run it i get this error:

Traceback (most recent call last):
File "C:\Python24\monkey.py", line 13, in ?
error: Couldn't open data\chimp.bmp

how can i fix it.
You need the chimp.bmp file in the correct directory. I don't even know python, but I can still figure that out Rolling Eyes
it is in the right directory because when i installed the documents and pygame i made sure i put them into the same one as python24. of course i am probably wrong and i will delete everything off of my computer relating to python and pygame and then try again.
I wouldn't do that. It's probably some stupid little error. You're sure that it's in the correct directory, and that you're not doing anything to it that would prevent python from opening it?
yeah i am sure because when i run the example program that comes with pygame it can load the chimp image and actually run the program.
It's possible it should be in the directory C:\Python24\data\chimp.bmp instead, but I'm just guessing. I would give that a shot and wait for someone with more experience in Python comes along. This is not exactly my area of expertise.
alright i guess i will do that
Put the chimp.bmp in the same directory as the script you are executing. I don't know Python, but most languages (when they execute) set their default path to the path that file is in (that made no sense whatsoever). Like so:

Ex.: If the path to the script is C:\MyScripts\Test\script.py, then the executing path is C:\MyScripts\Test\.

When you pass "chimp.bmp" it will search the executing path (C:\MyScripts\Test\) for the file. If it's not there, then you'll get an error.

Hopefully that'll work.
i got my problem fixed. see what the problem was, was that i had it looking for a folder that was inside another folder and so it could not find it. so all i had to do was take the data folder and stick it inside my python one.
...as Chipmaster said. Good luck with using pyGame.
thanks. does anyone by anychance know where i can find some good tutorials besides the ones on pygames site because of all of them i only saw like one good one.
The examples are enough to get you started, and then you just start using it, and the documentation on the API should be enough.
allright i guess i will look at and study the examples a couple of times to make sure i understand what exactly is going on. and another thing i think i might enjoy it a whole bunch since i can create my own crafty graphics using paint.
Also consider checking out The GIMP. It's much more powerful, can read and write tons of formats, and best of all, it's free & opensource.
alright i will have to check it out once i get a chance.
this isnt any coding problem with pygame or help post but pygame needs to hurry up and make a new update to work with python 2.5
Yes, heaven forbid you keep using 2.4 for a while longer Laughing
well i deleted the 2.4 installer and i have dial-up so i am not going to spend the time downloading it. but i also look at it this way now i can go back through my python book one chapter at a time and relearn everything instead of worrying about just making games and than maybe even make a couple of helpful scripts, programs or something.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum