Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 am)
Execfile is indeed clumsy. It seems to open a "DOS box", which gets all tangled up with Poser. You might try the Spawn family instead, which is only available in Python 2.2 (Poser 5). I don't know if that would be any better. Or use some of the extenders like SWIG or Pyrex to form an external module that can be called from Python. I'm learning how to use SWIG, and it's powerful but tricky. For a simple action with minimal passed values, it works nicely. As for closing down, I don't think Poser gives us a trigger event. (Seems like there was a discussion of this point some time ago; you might search back through the forum.) One possibility: Take advantage of the "exitfunc" action in Python itself. Since Poser closes down all the scripts that it owns, the exitfunc could call a out-of-Python program when your startup script detected that it was being closed down. This would require the script to keep running during the session, though. Another way: The startup script could trigger a plain little Windows app that keeps running in the background, watching the files that Poser rewrites when it's done. Specifically, when poser.ini changes its last-written time, Poser has just finished.
My python page
My ShareCG freebies
Ockham, Thanks so much for the detailed - and useful - reply. I'm using Execfile expressly to call a python script which has the spawn command in it. (spawn appears to be in new in 1.6.) Reason for this is that with NT-based Windoze (2K, XP) the python script calling the external program becomes "In use" per Windoze until the external program goes to EOJ. I.e. you can't edit the python script in the meantime. So I don't want to risk tying up poserStartup.py for potentially the whole session. Problem is when you try to access an "In use" py script from within Poser Python it appears fine, until you go to execute it. Then the ugly dialog box appears! Looks as if I may have found a route to a way around it though... Attempting to delete an "in use" script will fail in Poser python. 'Course it's a tad like the old method of testing suspected witches by burning - by the time you find out that the file isn't locked, it's gone! Fortunately virtual things like files are somewhat easier to recreate :-) Thanks for the insight on close down detection - both could work for this situation.
Hi, just have the same problem - when I load faces, sometimes the morphs are different and the dialog box comes with "some channels do not apply" - any idea how I can get rid of this ? I want to render several hundred faces, and unfortunately the figure they were created had different morph channels (which dont interest me at all) Greetings Mungo
The simple answer is to rename (or copy) the fc2 files to pz2. Then load them as poses, not faces. The "Some information does not apply" dialog box won't pop up when Poser thinks it's a PZ2.
My python page
My ShareCG freebies
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
There's a python script poserStartup.py that gets executed when Poser first starts. Anybody happen to know if there is a python script that gets run automatically as Poser is closing down, or someway to get one to run at that time? And a different but related question: Is there any way to handle exceptions - in the Python sense - from poser.Execfile()? It appears from my testing to just push it's Warning dialog directly to the screen in the event of an error such as missing file, and abends your python script - so you get no chance to try-except it. Am I missing something? FWIW, I'm trying to load a program when Poser starts, and ideally end it when Poser closes. Thanks.