{{ transformations:CallPythonAction.png}}
====== CALL PYTHON ======
Category: Workflow / External\\

\\ 
=====Description=====
The action executes the specified Python script. For more details, read [[python:start|Using Python in EasyMorph]].

\\
===== Capabilities =====

  * Executing a Python script from an EasyMorph workflow
  * Obtaining the workflow parameters in the Python script
  * Obtaining the input dataset of the "Call Python" action in the Python script
  * Returning a result dataset from the Python script as the action's output
  * Setting workflow status messages from the Python script
  * Monitoring workflow cancellation requests in the script
  * Generating EasyMorph warnings

\\ 
=====Action settings=====
^ Setting  ^ Description  ^
|Script<sup>*</sup>|Browse to and select the Python script to run.|

<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\

\\
====Settings settings====
^ Setting  ^ Description  ^
|Pass the input dataset to script|Select to pass the current dataset (as of this action) to the Python script.|
|Mode|Choose how EasyMorph will handle return data (if any).  Options:  //Don't return anything// (nothing is returned to EasyMorph), //Return output dataset// (the returned dataset becomes the new current dataset), or //Capture errors and continue// (return any script errors and continue the workflow).  |
|Don't auto-run this action as the script has side-effects  |Select this to manually run this action (if the script can/does affect external resources).  |

\\
====Python settings====
^ Setting  ^ Description  ^
|Use Python|Choose whether to run the script within a virtual environment (Option: //VENV//) or not (Option: //Default//).  If VENV is selected, browse to and select the folder it is contained in.  |
|Working directory|Choose the script's working directory.  Options: //Current project's directory// (the folder containing the project's .morph file), //Python script's directory// (the folder that contains the Python script), or //Other//<sup>*</sup> (browse to and select, or create, the work folder).  |
|Arguments<sup>*</sup>|Enter any optional command-line arguments to pass to the script.  |
|Stdout|Select //Convert stdout into status messages// to display the script's output stream as status messages during the workflow run.  |

<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\

\\ 
=====See also=====

  * [[transformations:runprogram|Run program]]
  * [[transformations:iterateprogram|Iterate external program]]
