Forum: Poser - OFFICIAL


Subject: make a python script run a python script

Tyger_purr opened this issue on Mar 29, 2007 · 7 posts


Tyger_purr posted Thu, 29 March 2007 at 9:42 PM

I have some python scripts id like to add to my pull down menu but i fear relocating them may cause some problems. Is there a way to make a simple python script that will just run another python script?

My Homepage - Free stuff and Galleries


ockham posted Thu, 29 March 2007 at 10:03 PM

There are several ways to do it... but you'll probably run into more trouble than
it's worth.  When a script needs various modules or subparts, it will find the
modules nearest to itself, and those modules will often be wrong. 
(e.g. they were compiled to work in Poser 6, using Python 2.2,
 but you're trying to run them in P7 which uses Python 2.4)

It's best to copy the script, with its various accessories, into the main runtime
of the Poser version where you plan to run it, and set up a button in the usual
way.

My python page
My ShareCG freebies


ockham posted Thu, 29 March 2007 at 10:07 PM

If you still want to try it, you can write a script that looks something like this:

import poser
poser.ExecFile("c:Poser 6:runtime:python:poserScripts:basics:SnapTo.py")

Note the mac-style colon notation.....

My python page
My ShareCG freebies


Tyger_purr posted Thu, 29 March 2007 at 10:19 PM

well, i am keeping all my python stuff in my P7 runtime.

In order to get the python to run from the pull down it has to be in :poserscripts:ScriptsMenu which doens't bode well for things like gloworm that has multiple py files and subdirectories that would show up as submenus.

not to mention i'm not sure how it would handle being moved.

I'll give this a try and see what happens

thanx for your help

My Homepage - Free stuff and Galleries


ockham posted Thu, 29 March 2007 at 10:38 PM

Oh.  I haven't really tried the pulldown yet ... from a quick look, it didn't seem to
have any advantages over the buttons.   Sounds like it's even less convenient
than the buttons!

I was really hoping they'd make a Python segment of the library in P7, with thumbnails
and subfolders just like figures and props and so on. 

That would be a real step forward!

My python page
My ShareCG freebies


PhilC posted Fri, 30 March 2007 at 7:08 AM

Pretty much all my scripts start this way. If you have any of my scripts you can open the starter script in notepad and see how I have done it.


Tyger_purr posted Fri, 30 March 2007 at 8:08 AM

Quote - Oh.  I haven't really tried the pulldown yet ... from a quick look, it didn't seem to
have any advantages over the buttons.   Sounds like it's even less convenient
than the buttons!

I was really hoping they'd make a Python segment of the library in P7, with thumbnails
and subfolders just like figures and props and so on. 

That would be a real step forward!

 

I've found it quite nice.
for the average user it will be easier in many ways to create and follow than the buttons.
just add py files to the directory for them to appear in the menu and add subdirectories for submenus.
I prefer it over the buttons and would rather not have an additional library area.

i'm not getting glowworm to launch :(

Quote - Pretty much all my scripts start this way. If you have any of my scripts you can open the starter script in notepad and see how I have done it.

 

cool, i'll have to take a look. I'd like to add some of your utilities to my pulldown.

My Homepage - Free stuff and Galleries