[Maya-Python] pass Python Vector pointer ?

2017-02-22 Thread justin hidair
how do I pass a vector pointer to MItMeshPolygon.getNormal in Python 1.0 ? MScriptUtil doesn't have support for vector amirite? Tried with a list, tried initialized to None... Also would like to know how many of you are using Python API 2.o ? -- You received this message because you are

[Maya-Python] Re: How to us Custom MPxData from cpp in python.

2017-02-22 Thread Cameron Fulton
Ok, so after asking I plugged away and figured out how to do it. Here is what I found for anyone else who is interested in doing this. def getAttrPlug(nodeName, attrName): selectionList = OpenMaya.MSelectionList() try: selectionList.add(nodeName) except: return None

[Maya-Python] How to us Custom MPxData from cpp in python.

2017-02-22 Thread Cameron Fulton
Hi all, So I have a custom data type that I create in cpp that I use for an attribute on a custom node. My custom data type is pretty straight forward: class BlindData : public MPxData { public: BlindData(); virtual ~BlindData(); /** * Copy the local data from a similar data

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Justin Israel
I am not 100% sure on windows, but I will make a guess. It might be because when you are using a pipe you are having the child inherit the file descriptor (regardless of whether close_fds is used or works on windows). The child process is looping and writing on stdout (the inherited fd). When the

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Here’s another one I fully expected to work; replacing PIPE with a regular file. import subprocessimport threadingimport tempfile child = """\ import time while True: time.sleep(1) print("child: Still running..") """ pipe = tempfile.TemporaryFile() popen = subprocess.Popen(

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Christopher Crouzet
It's common when doing multiprocessing to have things working when they shouldn't in theory (I remember stumbling on a few such examples on StackOverflow, and writing many myself). This can be due to the order in which operations are being executed on either processes, the size of the

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
That sounds logical, but the theory doesn't hold when considering it works with Python standalone and with Houdini. :(​ -- 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

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Christopher Crouzet
If I am not mistaken, when a parent process is trying to exit normally, that is with no exception or such forced termination, then it needs to wait for all of its child processes to be joined. If one of them is blocked, then it won't join. On 23 February 2017 at 00:13, Marcus Ottosson

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Ok, I might have found a way to break this down further. This also freezes Maya on exit, until I close the new console window. import subprocessimport threading child = """\ import time while True: time.sleep(1) print("child: Still running..") """ popen = subprocess.Popen(

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Thanks Christopher. Maybe readline() is one of these, meaning that it won’t return until it receives something, which might never happen in your case after exiting Maya? That’s right, readline() blocks until something is passed, via send() in this case. The for line in iter(out.readline, b""):

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Christopher Crouzet
Disclaimer: this might be totally unrelated to your problem! :) A common source of deadlocks when using the `multiprocessing` module (or anything related to IPC) comes from calling receiving/sending functions that are blocking. Maybe `readline()` is one of these, meaning that it won't return

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
close_fds isn’t supported on Windows apparently. # ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr # DETACHED_PROCESS didn’t work either unfortunately, but it was worth a shot. I feel it must be related to this somehow. I’ve tried CREATE_NO_WINDOW

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Thanks Alok, I did experiment with both of those. Will try this again next. On 22 Feb 2017 11:30, "Alok Gandhi" wrote: > And for completeness also pass creationflags=DETACHED_PROCESS in Popen(). > > On Wed, Feb 22, 2017 at 7:28 PM, Alok Gandhi

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Alok Gandhi
And for completeness also pass creationflags=DETACHED_PROCESS in Popen(). On Wed, Feb 22, 2017 at 7:28 PM, Alok Gandhi wrote: > Hi Marcus, > > I am not sure if this will surely help, but you can set `close_fds=True` > in subprocess.Popen(). This ensures the

Re: [Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Just to be clear, the problem is leaving this subprocess open (you'll get a new terminal window appear) when trying to close down Maya. Doing so causes Maya to hang. On 22 February 2017 at 10:08, Marcus Ottosson wrote: > Hi all, > > I’m struggling to understand why my

[Maya-Python] Subprocess and deadlock

2017-02-22 Thread Marcus Ottosson
Hi all, I’m struggling to understand why my Maya session deadlocks when leaving a subprocess open whilst listening to its stdout in a thread. The thread is deamonised, and without the thread then closing down Maya works well. I’ve narrowed down the problem into this. import sysimport