I am using the following code on my raspberry pi (with debian as the os), and when i run it, it says:
cannot load image C:/root/desktop/Snake.bmp
Traceback (most recent call last): File "/root/game.py", line 25, in <module> background, tmp_rect = load_image('Snake.bmp') File "/root/game.py", line 11, in load_image raise SystemExit, message SystemExit: Couldn't open C:/root/desktop/Snake.bmp >>> cannot load image C:/root/desktop/Snake.bmp
this is the code:
import pygame, os import random from pygame.locals import def load_image(name, colorkey = -1): fullname = os.path.join('C:/root/desktop', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'cannot load image', fullname raise SystemExit, message image =image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect() def AllKeysUp(key): return key.type == KEYUP pygame.init() screen = pygame.display.set_mode((500,600)) pygame.display.set_caption('snake_run') background, tmp_rect = load_image('Snake.bmp') screen.blit(background, (0,0)) pygame.display.flip()
the image is where it should be (on the desktop)
also i tried without the C:, and it came up with the same error (well... almost)
anyone know what i am doing wrong?