Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
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.
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.
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"