Closed fredrikaverpil closed 11 years ago
May I suggest the following amendment to PY_CMD_TEMPLATE?
PY_CMD_TEMPLATE
PY_CMD_TEMPLATE = "import traceback\n" \ "import __main__\n" \ "g = __main__.__dict__.copy()\n" \ "g['''__file__'''] = '''{2}'''\n" \ "try:\n" \ "\t{0}(r'''{1}''', g, g)\n" \ "except:\n" \ "\ttraceback.print_exc()"
And to mCmd:
mCmd
mCmd = self.PY_CMD_TEMPLATE.format(execType, mCmd, file_path)
This will cause 'file' to get sent over to Maya and which will point to the script's file path, which is very useful. I'm using 'file' to import other scripts and image files which reside on paths relative to the script file getting executed.
I made a pull request instead.
May I suggest the following amendment to
PY_CMD_TEMPLATE
?And to
mCmd
:This will cause 'file' to get sent over to Maya and which will point to the script's file path, which is very useful. I'm using 'file' to import other scripts and image files which reside on paths relative to the script file getting executed.