Sat, Feb 1, 5:49 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: Mac Python cannot find modules added under Runtime/Python unless sys.path manual


an0malaus ( ) posted Sat, 06 October 2012 at 7:34 AM · edited Mon, 02 December 2024 at 4:34 PM

Hi all, I'm especially pleased to see that the snake-heads I respect most are getting to grips with wxPython UI issues on the Mac, in the absence of TkInter support under PPro2012. I frequently find, however, that python modules (defined by a folder/directory named for the module and containing an init.py file) are not found when they are located within the application's default Runtime:Python folder.

It seems very strange to me that the folder containing the module appears in the sys.path if I print it from the python shell, yet attempts by launch scripts which try to import the named module fail with "ImportError: No module named blah" errors. The vagaries of Python on the Mac seem to dictate that the folder containing the module named folder itself must be in sys.path or the module is deemed not to have been found. Indeed, if I execute sys.path.append('Applications/Poser Pro 2012/Runtime/Python'), a subsequent attempt to reference any module which resides in a folder within that directory will succeed.

This does seem logical, but I can only assume that it must work differently on windows as I don't see any complaints about the many free scripts that are distributed as modules.

I assume it would be possible to perform this sys.path.append within the launch script, but I wonder why it isn't being done as a matter of course. Again, I assume it's not required on windows systems.



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


PhilC ( ) posted Sat, 06 October 2012 at 8:03 AM

I hear you :)

I always use ....................

sys.path.append(pathname)

................ to ensure import success.

See the Wardrobe Wizard Menu.py in poserScriptsScriptsMenu for an example.


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.