exec (MEL)
"The string argument is a command which gets executed as a background
process from the shell"

That would be launching your python script in its own process, outside of
Maya, and most likely failing but you aren't checking the return code to
know.

I think what you really want is the python "execfile"
"Read and execute a Python script from a file.
The globals and locals are dictionaries, defaulting to the current
globals and locals.  If only globals is given, locals defaults to it."

Also, just use forward slashes all the time, even on Windows

Does this work the way you expect?

    python("execfile('/Server/MyFolder/Save/LPLFile.py')")




On Fri, Dec 13, 2013 at 8:10 AM, <[email protected]> wrote:

> I'd like to run a Maya Python Script (NOT a single Python command) from
> within my userSetup.mel script. The Python script is simple but does use
> some Maya-specific commands. The Pythong script for testing is:
>
> #Python script:
> import maya.cmds as cmds
> Returned=cmds.fileDialog(mode=1, title="Save Layer/Pass list for Miranda:")
>
>
>
> The closest I've gotten to running it from MEL is something like:
>
> //Within the MEL Script:
> python (exec("\\Server\MyFolder\SaveLPLFile.py"));
>
>
> I've tried various cnfigurations of \\, \\\\, //, etc to accomodate the
> potential errors of escape characters but nothing seems to have any effect.
> The python/exec command appears to run without error (to the Maya console)
> but the actual script is not running because a cmds.fileDialog() never
> appears. Even when there is a typo in the filename the command appears to
> run.....apparently there is some long-standing bug in python that doesn't
> return an error message properly under some instances.
>
> Any alternatives that might be a better method of running a Python script
> from within MEL?
>
>
>
>
> --
> 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/231755dc-700c-4961-bc54-1a214ac0fc75%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAPGFgA0SrN0GktQO_RhaqtmopaYa%2BmZRfGUS3N_Y6_nc5BckCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to