Unexplained file not found for an existing file

Posted by knishua on Stack Overflow See other posts from Stack Overflow or by knishua
Published on 2010-03-31T13:37:38Z Indexed on 2010/03/31 14:03 UTC
Read the original article Hit count: 392

Filed under:
|

Following is the error that occurs in this part of the code. Although the path is valid, a RuntimeError occurs—strange. What is happening, and how can I get this to work?

        for root,dirs,files in os.walk(self.path):
            for f in files :
                if (f.split('.')[1] == "mb"):
                z = utils.executeInMainThreadWithResult(self.contains,(f.split('.')[0]))
                    if not (isinstance(z,NoneType)):
                        cmds.symbolButton(self.arSubCategory + f.split('.')[0], image=(z[1].replace("\\","/")), width = 35,height = 70, c = "h.imp_file(" + "\"" + root.replace("\\","/")  + "/" + f + "\"" + ")")


def contains(self,imageName):
    print 'imageName : ',imageName,'\n'
    for root, dirs, files in os.walk(self.path+"images"):
        for g in files:
            x = re.search(imageName,g)
            if not (isinstance(x, NoneType)):
                print 'g ',root+"/"+g.replace("\\","/"),'\n'
                return (1,(root+"/"+g))

Error:

# z is (1, 'T:/Reference_Library/Reference_work/Char_models/Workfiles/images\\rboxdisk1\\female\\highpoly/granny01_highpoly.jpg')

Error: File not found: T:/Reference_Library/Reference_work/Char_models/Workfiles/images/rboxdisk1/female/highpoly/granny01_highpoly.jpg
Traceback (most recent call last):
File "<maya console>", line 115, in <module>
File "<maya console>", line 65, in showWindowanimLibrary
RuntimeError: File not found: T:/Reference_Library/Reference_work/Char_models/Workfiles/images/rboxdisk1/female/highpoly/granny01_highpoly.jpg

© Stack Overflow or respective owner

Related posts about python

Related posts about maya