User friendly, cross-platform, Python addons for Poser?

  • I'm looking for some feedback and suggestions on ways to create installer scripts for Poser Python modules/addons to guarantee common functionality between Poser Python scripts on Windows and macOS.

    It's so long since I installed any Python based Poser addon that didn't require me to have detailed knowledge of where to put files on different platforms, that I can't remember if I ever came across anything which can do what I want.

    Specifically, I want an installer (whether it be a Windows .exe, macOS .app or python script) appropriate for the selected platform, which can install either Python addons or site-packages and make them available for import by a python script which the user can run within Poser. The addons or site-packages, which I will determine prior to distribution or installation, will provide equivalent or missing functionality present on either the Windows or macOS Poser Python distribution, but not on the other. E.g. Windows Poser has working Tkinter, while macOS Poser does not; macOS Poser Python supports TrueType and OpenType fonts out of the box, while Windows Poser Python is missing the _imagingft C module; ShaderWorks' Postwork Manager can save JPEG images on Windows, but not on macOS without replacing PIL with Pillow.

    I want to avoid having to cripple a script which is fully functional on one platform, just so it can run, unaltered, in the reduced feature-set environment of the other platform.

    The first requirement is that it doesn't require the user to know where their Poser application is installed, or where the Poser Python libraries live.

  • Poser Ambassadors

    You didn't mention pip. Is that because it doesn't do what you want, or because it's not included with Poser, or because you weren't aware of it?

  • @anomalaus But every Poser user SHOULD know where the Poser app is installed and where the Python libraries live. Ease of use is one thing, but that's no excuse for voluntarily staying stupid.

  • @bagginsbill I'd like to avoid the user having to use command line tools, to essentially avoid them having to type or copy and paste a command into an interpreter. I'm looking for a process as simple as:

    Download repository/archive
    Extract contents of archive
    Read ReadMe.txt, which tells you to execute an included installer which puts all the components in the proper places.
    Execute the installer

    Maybe I'm underestimating the average Poser user. I read that Windows Poser folk are quite comfortable with unzipping newly downloaded content directly into their Runtime folders. I've never been so trusting as to let an archive tool possibly overwrite something.

    I have used pip on several occasions to install packages on Python outside Poser, but have not, so far, looked for a way to use pip on Poser's python installation. The last time I seriously poked into Poser's Python packages was to install SciPy to do spline interpolation prior to the UnaffectedValue() method being released, and a replacement NumPy module which was compatible with the only SciPy I could download at the time. All of which had to be installed by hand and specific .pth files created so they could be found and imported by Poser Python scripts. All of which had to be done within the Poser Pro

    I haven't done more with Poser Python on Windows than check that my scripts don't get the same results there as under macOS. I don't yet understand why Poser Python on Windows can't use TrueType or OpenType fonts with PIL, other than that the _imagingft/freetype module isn't present.

  • @bagginsbill I can now provide further answer your relevant question on why I didn't mention pip (apart from never having used it within Poser Python, plus the mandatory deprecation not yet having come into effect).

    I have just discovered, while trying to use it to install the OpenEXR package, that the OPENSSL bundled with Poser Python on macOS includes TLSv1.0. Unfortunately this version of the certification protocol is now under permanent, mandatory deprecation.

    The bundled pip (9.0.1) needs to be upgraded to at least 9.0.3, apparently, to support TLS1.2 which is required by the servers as a mandatory minimum, now. No doubt bundling the latest available Python2.7 release with the next Poser release would sort that problem, but until then...

  • Well, although I know where my Poser is installed, and I know where the Pythoon folders reside in that, I still would LOVE an easy installer. I have things that worked on my old computer, on my old install. And now ... I've somehow got them installed wrong. Bits for EZ Skin for instance. So they're "not there" (although yes they are, but not where they're expected to be, apparently)

    I unzip stuff to my Runtime. I check the zip file first to ensure it has a correct structure, and then drag it to where it should go.

    But as soon as there's no proper Runtime structure in the zip (as in "a sinlgle .py" file) I'm a bit lost.

  • This is why I ALWAYS manually install. I've been doing that for decades with my 2D apps, and continue to do it with my 3D apps. I just don't trust the zip creator to put everything exactly where it needs to be, OR, since Poser has lightened up with the Library in general, where I WANT things to be.

    It might take longer, especially if you have half a dozen (or more) items to install. It's a lot easier for me to do it right the first time, then to have to hunt out where items are, so I can move them where I want them to be.

  • @anomalaus

    import sys,os
    libpath=os.path.join("Python", "lib")
    [p for p in sys.path if libpath in p][0]

    Results in 'C:\Program Files\Smith Micro\Poser 11\Runtime\Python\lib'.
    Works with any OS Python supports.

  • @adp said in User friendly, cross-platform, Python addons for Poser?:

    import sys,os
    libpath=os.path.join("Python", "lib")
    [p for p in sys.path if libpath in p][0]

    Sniff ;_;

    >>> import sys,os
    >>> libpath=os.path.join("Python", "lib")
    >>> [p for p in sys.path if libpath in p][0]
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
    IndexError: list index out of range
    >>> libpath
    >>> [p for p in sys.path if libpath in p]
    >>> sys.path
    ['/Applications/Poser 11/Runtime/Python/poserScripts/Wacros/UserDefined', '/Applications/Poser 11/Runtime/Python/poserScripts/Wacros/UserDefined', '/Applications/Poser 11/Runtime/Python/poserScripts/Wacros/UserDefined', '/Applications/Poser 11/Runtime/Python/poserScripts/Wacros', '/Applications/Poser 11/Runtime/Python/poserScripts/Wacros/UserDefined', '/Applications/Poser 11/Runtime/Python/poserScripts/ScriptsMenu/MyScripts/Utilities', '/Applications/Poser 11/Runtime/Python/poserScripts/ScriptsMenu/MyScripts/Cameras', '/Applications/Poser 11/Runtime/Python/poserScripts/ScriptsMenu/MyScripts/Cameras', 
    >>> libpath = 'Python'
    >>> [p for p in sys.path if libpath in p][0]
    '/Applications/Poser 11/Runtime/Python/poserScripts/Wacros/UserDefined'

  • @adp on macOS, the actual Python runtime is part of the package. @eclark1849 I do know perfectly well where Poser's python libraries are, but I do not yet trust the macOS Python distribution's tools to install packages using either pip within the macOS Python or the unix command line HomeBrew or other package managers to correctly install or update packages within Poser's Python runtime hierarchy, which is not the one within /Applications/Poser 11/Runtime/Python, though it did use to be for earlier Poser releases.

    When I look at the Package Contents, I see:
    0_1538749726962_Screen Shot 2018-10-06 at 12.27.47 am.png
    0_1538749737152_Screen Shot 2018-10-06 at 12.28.23 am.png
    showing that in /Applications/Poser 11/ I have duplicated the pip and pip-9.0.1.dist-info folders and successfully told Poser Python's pip to uninstall itself, knowing that I can rename those duplicate folders and get it back. But there's no point in that unless I can determine what commands I can give to that version of pip to prevent it from attempting to download packages (including it's own update to 9.0.3 or later) from the PyPI servers which since April 2018 refuse to accept connections from OpenSSL clients using TLS prior to v1.2!

    The other problem (apart from my inexperience in these matters) is that the pip bundled with Poser Python seems to be all source, whereas what I get in the macOS Python 2.7.14 after a Homebrew update and pip upgrade appears to be only dynamic libraries and such, with no match (that I've found yet) for any of the hierarchies exhibited within Poser's Python framework.