Sun, Dec 22, 7:24 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: 2024 Dec 02 3:16 pm)

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: runPythonScript not in docs-question


grichter ( ) posted Fri, 31 August 2007 at 9:31 AM · edited Tue, 26 November 2024 at 11:57 PM

The command runPythonScript, which I have seen samples of and people use I can't find any reference to in P7 Python Methods Manual.

My key question actually is must myscript.py be located in the ":runtime:python:"  of the base runtime for the version of poser I am using or can it be elsewhere when called by the runPythonScript command? Like in a poser library folder for example?

Pages 1 and 2 of the manual talk about script locations in the script menu etc. But since I can't find a reference to the runPythonScript command I need a clarification. No where in the docs can I find verbiage that states a script must be in the root python folder to work.

I can run my script directly with it located elsewhere or outside the base runtime and in a library folder. It does work when located inside the python folder. But when I use relative or abosulte paths to a location outside the root python folder...nothing. So either I am missing a peice of code or it can't be done.

thanks

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


PhilC ( ) posted Fri, 31 August 2007 at 10:07 AM

runPythonScript is a command used within a Poser file such as a CR2, PZ2, MZ5 etc. It is not a Python method.

You can place scripts outside of the local runtime but you will need to include a file within RuntimePythonLibsite-packages to enable it to be recognised. See the README file within that folder for details. Although I have used this feature and found it to work I'm of the opinion that you need to have an outstandingly good reason to make it worth the trouble.

To get Poser to recognise scripts within the local runtime use:-

####################################
import os
import sys
import poser

pathname = os.path.split(poser.AppLocation())[0]
scriptPath = os.path.join(pathname, 'Runtime', 'Your Folder', 'Your sub folder')
sys.path.append(scriptPath)

####################################

Hope that helps.


grichter ( ) posted Fri, 31 August 2007 at 5:30 PM

I'll take your word for it and rethink what I want to do and try to keep it simple. Only for private use so if it is a little nutso, I am the only one that has to deal with any problems thanks

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


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.