Mel - Python Problem


Hi CG Forum,

I’m pretty new in Python Programming and needed to use a Mel Script in my Code. Unfortunately, it doesn’t work at the Moment. I get the error message:
// Error: Line 9.62: “$varia” is an undeclared variable. //
// Error: setAttr “defaultRenderGlobals.imageFormat” $format;
// Error: Line 11.54: “$format” is an undeclared variable. //

I need the Mel Script for creating Screenshots (I know there is a way in Python).
Any Help would be appreciated.
Greetings Eli

---------My Python Function
def melScript(path, Name):
mel.eval(‘source"’+path+’";’) #works #makes Screenshot only Problem: Name übergeben

-------Mel File
global proc makePic(String $path,String $name)
// keep the old format
String $varia = $path+$name
int $format = getAttr "defaultRenderGlobals.imageFormat";
// set to render to .png image
setAttr “defaultRenderGlobals.imageFormat” 32;
// playblast one frame to a specific file
playblast -frame 1 -format “image” -cf $varia -v 0 -wh 240 175 -p 100;
// restore the old format
setAttr “defaultRenderGlobals.imageFormat” $format;

Another Problem would be the function cmds.file seems to ignore the material Setting (I want to export Objs without Material Files). If someone knows a good Workaround that would be great.

cmds.file(ChoosenPathObj +’/’+ownName, exportSelected=True, pr=False, typ=“OBJexport”,force=False,shader=False,stx=‘never’,op=“groups=0; ptgroups=0; materials=False; smoothing=0; normals=0”)