Python scripting

<< Click to Display Table of Contents >>

Navigation:  Best Practice Flows >

Python scripting

 

The Python scripting plugin lets users run Python scripts inside g-Space to extend built-in procedures, automate repetitive tasks and prototype custom calculations. Scripts are executed through a dedicated wizard that captures stdout, stderr and any exception and forwards them to the Output View.

 

Ribbon_bar_Python

 

Running a script

 

1.Open the Python scripting wizard from the Main Ribbon Bar.

2.Provide the path to the Python interpreter in Python executable. Default: python3.

3.Browse to the target script in Script path.

4.Click Run. The wizard remains open so scripts can be re-run repeatedly while tuning parameters.

 

Python_calculator

 

 

Execution model

 

Scripts run in a subprocess spawned from g-Space. The wizard captures the full stdout and stderr and prints them to the Output View once the subprocess finishes.

If the script raises an unhandled exception the traceback is routed to the Output View and the wizard reports the failure without disturbing the project.

Any file the script produces on disk can then be imported back into the project via the usual import wizards.

 

 

When to use

 

Automating data preparation steps that are tedious to drive through the GUI.

Running third-party geophysical libraries on project data and importing the result.

Prototyping a calculation before turning it into a native procedure.

 

 

See Also

 

Workflows

Output View