AttributeError: ,_io.TextIOWrapper' object has no attribute 'next'

import os
filePath = “C:\Users\siba\Desktop\1x1x1.blb”
BrickName = (os.path.splitext(os.path.basename(filePath))[0])

def ImportBLB(filePath):
file = open(filePath)
line = file.next()

while line:
    if(line == "POSITION:

"):
POS1 = ‘[’ + file.next().replace(’ ‘,’, ‘).replace(’
‘,’’) + ‘]’
POS2 = ‘[’ + file.next().replace(’ ‘,’, ‘).replace(’
‘,’’) + ‘]’
POS3 = ‘[’ + file.next().replace(’ ‘,’, ‘).replace(’
‘,’’) + ‘]’
POS4 = ‘[’ + file.next().replace(’ ‘,’, ‘).replace(’
‘,’’) + ‘]’

    try:
        line = file.next()
    except StopIteration:
        break
file.close()
return

ImportBLB(filePath)

This code works perfectly fine in the Python IDLE, but the next() command does not appear to exist in Blender?

Python version is 2.7.5, and I’m running Blender 2.68.0

blender 2.6x comes with its own python, version 3.3.x

you can do:

for line in file:
    print(line)

or use the magic method next()

Thanks for the help! that worked. :smiley: