Forum: Poser - OFFICIAL


Subject: Matmatic/Parmatic and python sys.path OR where to put matmatic script "modules"

an0malaus opened this issue on Nov 25, 2011 ยท 8 posts


an0malaus posted Fri, 25 November 2011 at 10:17 AM

Now on to matmatic; A search of the non-compiled module files finds in compile.py exactly what was needed to avert the problem that parmatic suffered from: adding the directory containing the directory (called matmatic) where compile.py resides to the sys.path so that the rest of the modules in the matmatic package can be located.

Yay! Matmatic never complains about not being able to find its own modules! Good work!

Matmatic's extensible configuration, allowing user customisations to be extracted and saving them from being overwritten when updates to matmatic are installed is smart and user-friendly. Specifying whole directory trees to be searched for matmatic scripts to be compiled is even available by appending a wildcard to the directory name. Terrific stuff!

Downloading a bunch of sample matmatic scripts by third parties seems like it should give a good insight into the learning process involved in getting to grips with matmatic. Wow, they all look like python scripts. Great! Couldn't be simpler. I might even learn some extra python tricks.

Oh. Wait. Someone's extracted a bit of commonly used code out of one of their matmatic scripts and is treating it just like a python module, i.e. to use a module, you need to import it so python knows where to find the classes and functions you're referring to. Let's try it. Ba-dum! Thankyou for playing :-(

Hmm. Matmatic found the module to compile because I told it to look in a certain place and all its subdirectories. Yet now there's another module not being found that exists in exactly the same directory being referred to ...



My ShareCG Stuff

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