Forum: Poser Python Scripting


Subject: Creating text files and knowing which directory to put them in - How?

Ajax opened this issue on Aug 18, 2003 ยท 25 posts


ockham posted Mon, 18 August 2003 at 10:30 AM

The glob.glob (nice name, eh?) will let you find directories. Something like this: import glob import os GoodPoseDirs = [] ChildFind = "runtime/Libraries/Pose/*" ChildFindNorm = os.path.normpath(ChildFind) ChildList = glob.glob(ChildFindNorm) for OnePossDir in ChildList: ~if os.path.isdir(OnePossDir): ~~GoodPoseDir.append(OnePossDir) You should be able to find the last-accessed directory by using os.path.getatime(). I haven't used this one, but the Python documentation gives good detail. This function gives the time since last access, so you would run through GoodPoseDir using os.path.getatime to find the one with the shortest interval since last use. You could also copy GoodPoseDir into a TKinter listbox for user selection.

My python page
My ShareCG freebies