> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# executePythonFilePackage

> Execute a Python script from a file. This operation differs from by executing the file for every file in the package. See to create custom Project Typ

Execute a Python script from a file. This operation differs from [executePythonFile](https://docs.flexagon.com/flexdeploy-9-0-documentation/flexdeploy-plugin-guides/flexdeploy-python-plugin-guide/executepythonfile.md) by executing the file for every file in the package.

See [Project Types](https://flexagon.atlassian.net/wiki/spaces/FD80/pages/10565812235/Project+Types) to create custom Project Type with various File Types and their Attributes. Custom Project Type is very useful with this operation, where you can create custom Package-based Build and Deploy automation. Here are some example scenarios where you custom project type would be useful:

* Source code repository has individual files for Informatica workflow and other objects that needs to be deployed and tracked individually.

* Source control system has individual files defining WebSphere resource configuration and they needs to be deployed and tracked individually.

If you were already using [Generic Project Type](https://flexagon.atlassian.net/wiki/spaces/FD80/pages/10561717223/Generic+Package-based+Project+Type), you can continue to use it as well.

This operation has the same support for inputs and outputs available to it as the [executePythonFile](https://docs.flexagon.com/flexdeploy-9-0-documentation/flexdeploy-plugin-guides/flexdeploy-python-plugin-guide/executepythonfile.md) operation. In addition it has the following variables available with information about a particular file.

### File Level Variables With Example

<table><colgroup><col /><col /><col /></colgroup><tbody><tr><th>**Variable name**</th><th>**Description**</th><th>**Value if File Name (with path) is /XXHR/publisher/APXSOBLX\_1.rtf**</th></tr><tr><td>`FILE_PATH`</td><td>File path of the package deploy file. (File Name (with path)) on the package deployment screen.</td><td>/XXHR/publisher/APXSOBLX\_1.rtf</td></tr><tr><td>`FILE_NAME`</td><td>File name of the package deploy file.</td><td>APXSOBLX\_1</td></tr><tr><td>`FILE_PATH_PREFIX`</td><td>File path, excluding the file name and extension.</td><td>/XXHR/publisher</td></tr><tr><td>`FILE_EXTENSION`</td><td>File extension on the package deploy file.</td><td>rtf</td></tr><tr><td>`SOURCE_FILE`</td><td>Fully qualified location of the file on the endpoint.</td><td>Fully qualified path to file being processed. This can be different locations for build and deploy workflow execution as there might be some checkout folder specified for build. See examples below for build and deploy workflow where FILE\_PATH is in bold text.<ul><li>/home/oracle/application/localhost/work/846808/840047/temp/PackageExecute/EBSCustomizations/XXHR**/import/XXHR\_Second\_CP.ldt**</li><li>/home/oracle/application/localhost/work/846808/840059/temp**/import/XXHR\_Second\_CP.ldt**</li></ul></td></tr><tr><td>`FILE_HASH`</td><td>The Hash of the file as generated recorded by FlexDeploy.</td><td /></tr><tr><td>`FILE_SCM_REVISION`</td><td>The SCM Revision of the package deploy file.</td><td /></tr></tbody></table>

All file attributes defined on Project Files tab are included as well.

# Project Properties

<table><colgroup><col /><col /><col /><col /></colgroup><tbody><tr><th>**Property Name**</th><th>**Property Code**</th><th>**Required**</th><th>**Description**</th></tr><tr><td>Stop On Deployment Error</td><td>`FDPYTHON_STOP_ON_DEPLOYMENT_ERROR`</td><td>No</td><td>Stop deploying package files if any error occurs. If unchecked all files will be deployed even if one or more files fails. This is for package operations only. True by default.</td></tr></tbody></table>

# Inputs

<table><colgroup><col /><col /><col /><col /></colgroup><tbody><tr><th>**Input Name**</th><th>**Input Code**</th><th>**Required**</th><th>**Description**</th></tr><tr><td>File Path</td><td>`FDPYTHON_INP_FILE_PATH`</td><td>Yes</td><td>File path of the file to run.</td></tr><tr><td>Python Executable</td><td>`FDPYTHON_PYTHON_EXECUTABLE`</td><td>No</td><td>e.g. python or python3 if executable is available on PATHOr specify the full path e.g. /u01/python3.7/bin/python3.Defaults to python.</td></tr></tbody></table>

# Artifacts

This operation delegates the consume/produce artifacts decision to the workflow developer.

# Endpoint Selection

This operation delegates endpoint selection to the workflow developer. The workflow editor will default the selection to "All", which selects all available endpoints associated to the Target. Selecting a specific resource will result in selection of endpoints associated to the Target which have that resource defined.

# Endpoint Execution

This operation delegates endpoint execution to the workflow developer. The workflow editor will default to "Any", which will execute on any one of the selected endpoints, which will be randomly picked from selected endpoints or a specific endpoint where previous step may have executed. Changing this value to "All" to will result in execution on all selected endpoints.

# Special Considerations

## FlexDeploy Properties

FlexDeploy will pass in any Properties normally available in workflows via System Environment Variables.

### Example

##### **Property Example**

```
import os
​
TEST_INP = ​os.getenv('TEST_INP')
```

## Outputs

User defined outputs – an output must be defined in the workflow editor to be accessible. Within your script use the setOutputs(key, Value) function to set any outputs.

### Example

##### **Output Example**

```
setOutputs("MY_STRING_OUTPUT","Output result") # output will be "Output result"
```

## Setting Status

The status of the File can be set in your script using several functions available, see the example below. If an exception occurs in your script, the status will be set to Failed. Statuses will only be set when deploying.

##### **Setting the status examples**

```
setObjectResultStatusSuccess() # Status will be Success
setObjectResultStatusFailed() # Status will be Failed
setObjectResultStatusSkipped() # Status will be Skipped
setObjectResultStatusNotAttempted() # Status will be Not Attempted
setObjectResultStatusIgnore() # Status will be Unknown
```
