change open to io.open which is compatiable in python2/3