Unicode Question, maya and python

Hey guys sorry i’ve been firing a lot of easy questions to you guys. however started trying to write in Python, and its been a while.

I’m trying to make a script that automatically creates an image plane with the image sequence onto the scene however i have run into a Unicode issue, and was wondering on how was the best way to solve this issue

import maya.cmds as cmds
import maya.mel as mel

SourceCam = cmds.ls( selection=True )
cmds.duplicate( SourceCam, rr=True, un=True )
cmds.parent (w=True);
DuplicatedCam = cmds.ls( selection=True )
“string”.encode(‘ascii’)
print DuplicatedCam
str(DuplicatedCam)
imagePlaneName = cmds.createNode(“imagePlane”)
mel.eval( ‘cameraImagePlaneUpdate “%s” “%s”;’ % (DuplicatedCam, imagePlaneName) )

the error i get is this:

// Error: file: C:/Program Files/Autodesk/Maya2013/scripts/others/cameraImagePlaneUpdate.mel line 48: The destination attribute ‘[u’camera2’].imagePlane’ cannot be found. //

Error: RuntimeError: file <maya console> line 8: Error occurred during execution of MEL script

I assume it jumps from python to Mel, so the string has changed however can anyone explain how to allow your strings or values to jump back and forth and solve this issue?

Worried that if i run Mel then make it a python string it’ll give me the same problem.

Thanks in advance for helping me out!

your problem is not Unicode related.

the return value of the duplicate command is always a list, even when you duplicate just one thing.

you need to pass the first (and only expected) item from the duplicate command.