On Tue, Mar 5, 2019, 7:38 AM likage <dissidia....@gmail.com> wrote:

> Hi Justin,
>
> I have managed to get it to work by using the absolute path but with those
> commands saved in another .py file within the list of python paths that
> MAYA is reading from..
> As such, my python file is as follows:
> import subprocess
>
> def main():
>     process = subprocess.Popen(['/bin/meld'], stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
>     stdout, stderr = process.communicate()
>
>
> One more question though - while I am able to execute my program, I could
> not work on my current maya session until this `meld` tool is closed.
> Wondering if this is a common thing when trying to run an external program
> in Maya, or if it is possible to get `meld` to work in the background?
>

That is caused by the pipes and the call to communicate that you are using.
You are asking it to block until the process is complete and to read the
stdout and stderr into variables. If you don't care about the output, don't
set those pipe parameters on the subprocess, and just check the
process.poll() right after you start it. It should return None if the meld
program is still running and didn't fail to start. Once meld closes, that
poll would return 0 for success or non-zero for error.

If it were some other program where you wanted to read the output without
blocking your main Maya process, you would need to start it in a thread and
read the stdout/stderr pipes actively.

> --
> 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_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/bf395230-be1b-44ee-ade7-e4d04739c43d%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/bf395230-be1b-44ee-ade7-e4d04739c43d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1HBx1rCUkq114JQPzkJFh5ddDLdAjb%3Ddq5_7FQVSn3Sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to