Author Topic: Issue with command line submitDict element  (Read 2922 times)


  • Jr. Member
  • **
  • Posts: 5
Issue with command line submitDict element
« on: October 17, 2012, 07:30:16 PM »
I am trying to basically replicate the call made by the Maya in-app command to call the same thing within a python script.  I can pull all the same variables from maya in exactly the same format as used in the mel script, but I keep getting errors saying the string is not translatable into a dict or qb.job.  It seems like it doesn't like white space or forward slashes in the dict statement, but it is (as far as I can tell) the same format as the mel command.  Perhaps I just don't understand this well enough yet, but any help to shed some light would be greatly appreciated.

The mel command the shows in the script editor is:
system("start \""+`qube_get_qubeguiPath`+"\"  --submitDict \"{'name':'maya batchrender "+`file -q -sn -shn`+"', 'prototype':'cmdrange', 'package':{'simpleCmdType':'Maya BatchRender ("+`qube_getCurrentRendererShortname`+")', 'scenefile':'"+`file -q -sn`+"', '-proj':'"+`workspace -q -rd`+"', 'range':'"+`playbackOptions -q -min`+"-"+`playbackOptions -q -max`+"','camera_all':'"+stringArrayToString(`listCameras -p -o`, " ")+"', 'renderLayer_all':'"+stringArrayToString(`ls -type renderLayer`, " ")+"','renderPass_all':'"+stringArrayToString(`ls -type renderPass`, " ")+"'}}\" ");

My python code for the same line looks like:
os.system("start qube.exe --submitDict {'name':'" + submitName + "','prototype':'cmdrange','package':{'simpleCmdType':'" + submitSimCmdType + "','scenefile':'" + submitSceneFile + "','-proj':'" + submitProj + "','range':'" + submitRange + "','camera_all':'" + submitCameraAll + "','renderLayer_all':'" + submitRenderLayerAll + "','renderPass_all':'" + submitRenderPassAll + "'}}")

The variables resolve to:
submitPrototype:  cmdrange
submitSimCmdType:  Maya BatchRender (mentalRay)
submitSceneFile:  Y:/Staff/Jason/MI_Test/test2/scenes/
submitProj:  Y:/Staff/Jason/MI_Test/test2/
submitRange:  1.0-60.0
submitCameraAll:  front persp side top
submitRenderLayerAll:  defaultRenderLayer

the error box I get is:
Submit Error:  String "{'name':'','prototype':'cmdrange','package':{'simpleCmdType':'Maya" not translatable into a dict or qb.job.

Traceback (most recent call last):
File "", line 2734, in <module>
File "<string>", line 1
SyntaxError:  EOL while scanning string literal


  • Jr. Member
  • **
  • Posts: 5
Re: Issue with command line submitDict element
« Reply #1 on: October 18, 2012, 04:47:34 PM »
Ok - I figured it out.  Just working on it too late and missed a few key slashes, quotes, and a function to create a short name for the renderer.


  • Administrator
  • *****
  • Posts: 493
Re: Issue with command line submitDict element
« Reply #2 on: October 18, 2012, 10:25:12 PM »
Good work; this is why the "submitDict" approach, while portable, can be tricky to work with.

If you're not interested in showing the submission dialog to the user, you can just build a job dictionary instead "import qb" into maya, and

Code: [Select]
for j in qb.submit(jobDict):
    print 'Submitted %(name)s: %(id)s' % j

Or you may want to simply get the jobId's of the submitted jobs, and show them to the user in a dialog:

Code: [Select]

submittedIds = [ x['id'] for x in qb.submit( [jobDictA, jobDictB,...] ) ]

In order to build the desired job, you may want to look at a previously submitted job, and see what values need to be set in the job's top-level attributes, as well as what values are present in the job['package'].

The SimpleCmd modules that get used when you submit this way may "translate" your submitDict into a slightly different set of "maya -batch" cmdline arguments that get submitted, and so you should inspect a job that the SimpleCmd module submitted, and try to duplicate the submitted job.

It will help you avoid string quoting hell like this in the future.
« Last Edit: October 18, 2012, 10:27:54 PM by jburk »


  • Jr. Member
  • **
  • Posts: 5
Re: Issue with command line submitDict element
« Reply #3 on: October 19, 2012, 02:38:07 PM »
That's some great knowledge - thanks a lot for the reply.
I'm sure I'll be able to implement some of that to clean things up in my spaghetti code a bit!