Forum: Poser Python Scripting


Subject: XML Parsing (miniDOM) In PoserPython - The Very, Very Basics... :o)

3dcheapskate opened this issue on Feb 15, 2013 · 9 posts


3dcheapskate posted Mon, 18 February 2013 at 10:51 PM

Since Poser 6 seems to be the one that's causing most problems I should really just RTFM! So does P6 use Python 2.4.1, 2.4.2, 2.4.3 or 2.4.4? I've found the Python docs for all versions and want to bookmark the P6 one.

In fact a sticky thread on this forum with links to the appropriate Python Library Reference's for each Poser version would be very useful for people like me (and help avoid a lot of stupid questions!

😉

Anyway, back to my file-handling queries - It's progressing well and successfully reading data from a CSV file (I abandoned the XML approach) into various lists and lists of lists. I've been using an absolute path for my data file, but I really want to use a relative path. The most logical location for the datafile is in the same folder as the script, i.e.

/Runtime/Python/poserScripts/3DCheapskate/

The following code seems to give me the correct filename when run from P6, P8 and P9 (I didn't use os.path.curdir since it doesn't won't work in P6) on a Windows 7 PC

import poser
import os
poserpath=os.path.split(poser.AppLocation())
print  os.path.join(poserpath[0],'Runtime','Python','poserScripts','3DCheapskate','datafile.txt')

This should work on other versions of Windows, and on a MAC too, yes?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).