Show all scripts

CallPythonScript

Category: Python
Author:
Description: / Python string wrapper for hybrid DM scripting. // // Since all the examples given by the DM help file are rather unwielding due to using explicit Python strings, // this simple script is written to build from a Python .py ASCII file and search for a single field of parameters // which are to be passed from DM to Python. // The advantage to this method is that the Python code does not need to be pre-loaded, and the build function can be // looped through another DM script, i.e. the main script can contain the following code to avoid version conflicts: // // number major, minor, debug, retval = 0 // getApplicationVersion(major,minor,debug) // if(!((major > 2) && (minor >= 40))){ result("nDM version too low for Python execution."); exit(0); } // else{ retval = ExecuteScriptFile( DMScriptPathToBuildFunction ); } // // Variables from the main script file are most easily passed through tags. // // The input field in Python has to be marked by # and #. // Some parameters need to be adjusted by the user, in particular: // - adjust the BuildInputString function to match your desired input // - adjust the indent and mainThread parameters in the main function // // Since Python logic works by indents, improper indentation of the input field can easily lead to errors since the // string match method only works for exact matches and not substrings. // // An example of a simple Python test code that requires an open front image is attached at the end of the script. // // Goettingen 2021, Jonas Lindner and Ulrich Ross
Comments: Please note the CallPythonScriptArgs.py-file in the suppplement
Acknowledgements: Written by Jonas Lindner and Ulrich Ross, Goettingen 2021
Script version: 1.0
DM/GMS version: 3.4
Script written as a function: No
Source: Show code
Download Source Code: Download
Download Zip File: Download