texture path problem

Hi, please help me with this code

   

#i have a text.txt file with the first line 'C:	extures	exture.jpg'
    text = open("text.txt","r")
    text2 = text.readline()
    text.close()
    
    im1 = Image.Load(text2)

and i recive the message “IOError: couldn’t load image”

can someone help me to solve this?

You need to escape the " \ " in the path, by adding an extra " \ ".
‘C:\ extures\ exture.jpg’

Hello, i tried it but don’t :frowning: , there is another posible solution??? Thank You

I just tried this and it worked.


import Blender
from Blender import *
txt_file =open("c:\\file_list.txt","r")
the_file = txt_file.readline()
txt_file.close()
#the_file = "c:\\checker_board.jpg"
iml = Image.Load(the_file)

The file list contans the text “c:\checker_board.jpg”
Also verify that the files you are trying to read are in the locations you specify in your script.