UnicodeDecodeError: 'ascii' codec can not decode byte 0xc3 in position 18: ordinal not in range (128)

0

Well no idea what happened, change the code to another folder to send it and I have given these errors

No se puede cargar imagen: mmempty.png
Traceback (most recent call last):

File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 
2888, in run_code
self.showtraceback(exception_only=True)

File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 
1747, in showtraceback
value))

File "C:\Python27\lib\site-packages\IPython\core\ultratb.py", line 637, in 
get_exception_only
return ListTB.structured_traceback(self, etype, value, [])

File "C:\Python27\lib\site-packages\IPython\core\ultratb.py", line 503, in 
structured_traceback
lines = ''.join(self._format_exception_only(etype, value))

File "C:\Python27\lib\site-packages\IPython\core\ultratb.py", line 617, in 
_format_exception_only
Colors.Normal, s))

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18: 
ordinal not in range(128)

This is a fragment of the code that I think is where the problem is

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

pygame.init()
#Se crea la ventana y le damos un titulo
screen = pygame.display.set_mode((580,680))
pygame.display.set_caption('Mastermind!')
#Se asignan los colores a utilizar y los guardamos con sus nombres respectivos
GREY = (127,127,127)
BLACK = (0,0,0)
WHITE = (255,255,255)
font = pygame.font.SysFont('agencyfb', 24)
clock = pygame.time.Clock()

#Carga las imagenes del juego en general data
def Cargar_Imagen(name, colorkey=None): 
   #Carga y guarda las imagenes de la carpeta Diseño
   fullname = os.path.join('data', name)
   try:
      image = pygame.image.load(fullname)
      #Muestra un error si la imagen no es encontrada y dice el nombre de la imagen faltante
   except pygame.error, message:
      print 'No se puede cargar imagen:', name
      raise SystemExit, message
   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()

class Boton_Colores(pygame.sprite.Sprite):
def __init__(self,image):
    pygame.sprite.Sprite.__init__(self)
    self.image, self.rect = Cargar_Imagen(image)
def setCords(self,x,y):
    self.rect.topleft = x,y
    screen.blit(self.image, (x,y))
def pressed(self,mouse):
    if mouse[0] > self.rect.topleft[0]:
        if mouse[1] > self.rect.topleft[1]:
            if mouse[0] < self.rect.bottomright[0]:
                if mouse[1] < self.rect.bottomright[1]:
                    return True
                else: return False
            else: return False
        else: return False
    else: return False
    
asked by Wolf 08.10.2018 в 23:28
source

0 answers