Hey folks

I am running Maya 2014 os windows 8.1 64 bits.

I have dowloaded python PIL from this URL 
<https://mistermatti.wordpress.com/2014/02/04/maya-2014-with-pythons-pil-module/>
 and 
have installed the folder with the files in 
...maya2014/python/Lib/site-packages/

Here is my script :

import os
import maya.cmds as cmds
from PIL import Image

#change the path here
path = "/Users/francesco/Desktop/Géosésame/Maya/sourceimages/selectionMaya"


#list the items in the folder
dir = os.listdir(path)

junk = [".mayaSwatches", ".DS_Store", ".picasa.ini"]


for texture in dir:
    if texture not in junk:
        #Load Image in Pillow
        img = Image.open(texture)
 #create a nurbsPlane for each texture
        mesh = cmds.nurbsPlane(name = texture)
        #create a shader
        shader=cmds.shadingNode("blinn",asShader=True)
        #a file texture node
        name = texture.split(".")[0]
        file_node=cmds.shadingNode("file", name = "file_" + name, 
asTexture=True)
        #assign a texture
        cmds.setAttr( "file_" + name +'.fileTextureName', path +'/'+ 
texture, type="string")

        # a shading group
        shading_group= 
cmds.sets(renderable=True,noSurfaceShader=True,empty=True)
        #connect shader to sg surface shader
        cmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' 
%shading_group)
        #connect file texture node to shader's color
        cmds.connectAttr('%s.outColor' %file_node, '%s.color' %shader)
        cmds.select(mesh)
        cmds.hyperShade( assign=shader)

Here is the issue :

# Error: line 1: IOError: file C:\Program 
Files\Autodesk\Maya2014\Python\lib\site-packages\PIL\Image.py line 1952: 2 
# 

Obviously the issue is on this line : 

img = Image.open(texture)

What Do I miss ?

Thanls for the help

Fransua


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a7e7c289-b5e4-4fd1-a7c2-c20b511b074d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to