Fri, Mar 29, 3:11 AM CDT

Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Mar 19 1:03 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: Py2 to Py3 conversions


structure ( ) posted Sun, 08 November 2020 at 10:31 AM · edited Tue, 26 March 2024 at 2:41 PM
Forum Coordinator

A thread to assist in the conversion of python 2 to python 3. Anything you come across that you have found a conversion for can be placed in this thread. examples

python 2 : 
print x 
Python 3:
print( x )

python2 
wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
python3:
wx.SystemSettings().GetFont(wx.SYS_DEFAULT_GUI_FONT)

python2:
outfile.write( "[advanced]" + "\n")
python3:
outfile.write( bytes("[advanced]" + "\n"), encoding = 'utf8' )

Locked Out


adp001 ( ) posted Sun, 08 November 2020 at 10:52 AM · edited Sun, 08 November 2020 at 10:53 AM

The standard Python way works fine for file writing:

with open("test.txt", "w") as fh:
    for idx in range(10):
        print(f"Line {idx}: Test", file=fh)  # The 'f' prefix means: format, Py3 only.

with open("test2.txt", "w") as fh:
    for idx in range(10):
        fh.write(f"Line {idx}: Test\n")




Dizzi ( ) posted Sun, 08 November 2020 at 1:03 PM

https://wxpython.org/Phoenix/docs/html/MigrationGuide.html https://docs.python.org/3/howto/pyporting.html



structure ( ) posted Sun, 08 November 2020 at 11:45 PM
Forum Coordinator

Thanks Dizzi - useful info :)

Locked Out


Dizzi ( ) posted Thu, 19 November 2020 at 8:26 AM

If you saved objects with pickel in older poser versions and want to load them in Poser 12 you will have to do something like that:

with open(filename, "r") as fd:
 lines = [line.rstrip("rn") for line in fd.readlines()]
 result = pickle.loads(bytes("n".join(lines), encoding='Latin 1'))



3dcheapskate ( ) posted Wed, 11 May 2022 at 9:55 PM · edited Wed, 11 May 2022 at 9:55 PM

Can we make this thread a sticky/pin/whatever-you-call-it ?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.

*also available in ShareCG, DeviantArt, DAZ, and CGBytes flavours.



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.