#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 python_inside_m...@googlegroups.com.
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.
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.
The PYTHONPATH is a system environment variable. There are a few ways to change those and reach operating system is a bit different. It will only be read when the application is first launched.
The point of the python path is to prepare python to have access to the correct python libraries. You can get similar functionality with sys.path.append('/my/path')
I have questions about PYTHONPATH, where is it by default? How can I change it and what I get by changing it?
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANESWi2eWz9dUuLZ0BrYg7kWJZuUbWaDuJd4S0botYAVuOeAcA%40mail.gmail.com.
python("import myscript");
python("myscript.run()");
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 Mayan-Specific Commands. The Pythong script for testing is:#Python Script:
import maya.cmds as CMDS
Returned = cmds.fileDialog (mode = 1, title = "Save Layer / Pass drop 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 Appear. Even when there is a typo in the filename The command Appears to run ..... apparently there is some long-standing bug in python That does not return an error message properly in some instances.Any alternatives That might be a better method of running a Python script from within the MEL?
string $MelCommand = "python(\"import sys\"); python(\"sys.path.append('" + $sourceLocationPath + "')\"); python(\"import YOURMODULE\");python(\"YOURMODULE.launchMethod()\");";
python("import sys");
python("sys.path.append('" + $sourceLocationPath + "')");
python("import YOURMODULE");
python("YOURMODULE.launchMethod()");