Forum: Poser Python Scripting


Subject: Which Python versions are compatible with Poser?

maur_2005 opened this issue on Dec 28, 2019 ยท 11 posts


maur_2005 posted Sat, 28 December 2019 at 10:21 AM

Hi Folks, I'm trying to program my first script, my question is which python version is compatible with Poser 11?

and what IDE do you recommend me for programming Poser scripts?

Thank you


adp001 posted Sat, 28 December 2019 at 10:41 AM

Python Version 2.7

IDE's: Visual Studio Code (free) or PyCharm (free).

There are others, but as a beginner you need as mutch support from your IDE as you can get. Using one of those IDE's mentioned makes life mutch easier for a programmer :)




maur_2005 posted Wed, 08 January 2020 at 5:15 PM

Thank you so much adp001!


an0malaus posted Wed, 29 January 2020 at 2:57 PM

@adp001 do VSC and PyCharm actually make use of an import poser statement and allow you to syntax check code and provide command completions for Poser methods? I just use a Python format aware text editor, so it has no syntax checking, though it can list classes, methods and function definitions, but it's not an IDE.

The Python IDE called IDLE that's bundled with macOS python 2.7 doesn't have a clue where to import poser from. Would adding the location of the python framework within Poser give any help to that?



My ShareCG Stuff

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


adp001 posted Wed, 29 January 2020 at 3:28 PM

an0malaus posted at 10:10PM Wed, 29 January 2020 - #4378272

@adp001 do VSC and PyCharm actually make use of an import poser statement and allow you to syntax check code and provide command completions for Poser methods?

Both: No syntax checking for Poser. But both do remember earlier written statements. So you have to type it mostly once.

VSC needs less resources, but PyCharm is overwelming complete. For small scripts VSC is fine. But I do most of my work with PyCharm, because he handles hundreds of referenced files as it where nothing. Change a class/function name or change the signature? No problem. PyCharm handles it even in monster-projects without any mistake (and ASKS before something is overwritten or changed!).

The Python IDE called IDLE that's bundled with macOS python 2.7 doesn't have a clue where to import poser from. Would adding the location of the python framework within Poser give any help to that?

Lib "poser" and "poser.Scene()" are hardcoded into Poser. So there is no reference. Could be a nice project :)

Maybe the Python console can help. If I remember right, the source code is in Poser Python's folders somewhere.




JoEtzold posted Thu, 30 January 2020 at 8:34 AM

Do you use PyCharm in the free community version or as the paid/sold version ?


adp001 posted Thu, 30 January 2020 at 1:09 PM

JoEtzold posted at 8:08PM Thu, 30 January 2020 - #4378350

Do you use PyCharm in the free community version or as the paid/sold version ?

Paid version of PyCharm does not add something for Python scripting. The free version has anything needed.




adp001 posted Thu, 30 January 2020 at 1:15 PM

an0malaus posted at 8:14PM Thu, 30 January 2020 - #4378272

@adp001 do VSC and PyCharm actually make use of an import poser statement and allow you to syntax check code and provide command completions for Poser methods? I just use a Python format aware text editor, so it has no syntax checking, though it can list classes, methods and function definitions, but it's not an IDE.

The Python IDE called IDLE that's bundled with macOS python 2.7 doesn't have a clue where to import poser from. Would adding the location of the python framework within Poser give any help to that?

Problem solved. At least to 90% :)

I'll make a new thread for this.




heilei posted Wed, 05 February 2020 at 3:53 AM

adp001 posted at 11:49AM Wed, 05 February 2020 - #4378373

...

Problem solved. At least to 90% :)

I'll make a new thread for this.

How did you solve this? I'm facing the same problem: how to make PyCharm aware of the Poser import, so that it can auto-complete, check etc. all Poser methods and variables. There doesn't seem to be a corresponding Python module anywhere inside the Poser app bundle (or maybe they just hid it really well...).

Regards, HeiLei



adp001 posted Wed, 05 February 2020 at 5:49 AM

No, there is no modul. This is not how things work.

If an editor needs to know about a python modul, the editor must analyse that modul with standard Python methods. This is how PyCharm does it. Any Python modul (lib) imported gets analysed.

Posers Python extension is not a modul as usual. It is closed source and burried deep into Poser itself to protect copyrights. So some information are not extractable. Number or type of functioncall parameters for example. But my script tries the best to extract useful information and write out a library that can be imported like usual (insteed of Poser).

https://www.renderosity.com/mod/forumpro?thread_id=2942414




heilei posted Wed, 05 February 2020 at 5:57 AM

Ok, thanks! I saw that thread earlier, but didn't realize it actually was a solution to this very problem. Will try it right away...