im trying to read in and float infomation from a text file, however I dont seem 
to be having any luck getting my script to recognise anything from past the 
first line, and sometimes for no apparant reason it wont even recognise the 
first line correctly. 

def openLight():

file = open("C:\Users\Admin\.nuke\light.txt", 'r')
    
        data = file.readlines()
        for line in data :       
                light = line.split()      
                x = float(light[0])
                y = float(light[1])
                z = float(light[2])
                r = float(light[3])
                g = float(light[4])
                b = float(light[5])
        file.close()


For reference the .txt im trying to read in is just simply:

5
2
6
8
2
1


The error i seem to be getting in Nuke is: 

Traceback (most recent call last):
  File "<string>", line 12, in <module>
IndexError: list index out of range

Any help would be appreciated. Thanks



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to