-4

So to start off I'm converting pyggel to python 3 all the converted files run in IDLE no issues but when I run the game included in python 3 I hit this error

GameObject.__init__(self, game, obj=pyggel.mesh.OBJ("data/gun.obj", 
colorize=[0.2, 0.2, 0.2, 1]),
File "/home/pi/Downloads/PYGGEL-V0.08-alpha4c/pyggel/mesh.py", line 58, 
in OBJ
cur_mtl.set_color(map(float, values[1:]))
File "/home/pi/Downloads/PYGGEL-V0.08-alpha4c/pyggel/data.py", line 355, in 
set_color
    if len(color) == 3:
 TypeError: object of type 'map' has no len()

here is the part of the code the error comes from:

class Material(object):
"""A simple class to store a color and texture for an object."""
def __init__(self, name):
    """Create the material
       name is the name of the material"""
    self.name = name
    self.color = (1,1,1,1)
    self.texture = BlankTexture()

def set_color(self, color):
    """Set color of material."""
    if len(color) == 3:
        color += (1,)
    self.color = color

def copy(self):
    """Copy material."""
    a = Material(self.name)
    a.color = self.color
    a.texture = self.texture
    return a

update my question isn't a duplicate I'm not trying to find out the lengh of a list the "if len()" statement is suppost to set a color (also this module is still working in python 2.5)

1 Answers1

0

Convert to list first

len(list(color))