Fri, Feb 7, 4:43 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: More Q's on controlling external apps from Poser Python


layingback ( ) posted Wed, 03 December 2003 at 3:34 PM · edited Sat, 27 July 2024 at 2:30 AM

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.


ockham ( ) posted Fri, 05 December 2003 at 10:01 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


layingback ( ) posted Fri, 05 December 2003 at 5:05 PM

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.


MungoPark ( ) posted Tue, 09 December 2003 at 6:53 AM

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


ockham ( ) posted Tue, 09 December 2003 at 9:22 AM

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


MungoPark ( ) posted Tue, 09 December 2003 at 9:43 AM

Man you are great - was just looking for a monkey to press enter every ten minutes for a week - Mungo


Privacy Notice

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.