--- title: "system.file.getTempFile" description: "Creates a new temp file on the host machine with a certain extension, returning the path to the file." --- # system.file.getTempFile > Creates a new temp file on the host machine with a certain extension, returning the path to the file. This function is used in **Python Scripting**. ## Description Creates a new temp file on the host machine with a certain extension, returning the path to the file. The file is marked to be removed when the Java VM exits. :::note This function is scoped for Perspective Sessions, but since all scripts in Perspective run on the Gateway, the file must be located on the Gateway's file system. ::: ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.file.getTempFile(extension)` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `extension` | An extension, like ".txt", to append to the end of the temporary file. ### Returns **String** - The path to the newly created temp file. ### Scope Gateway, Vision Client, Perspective Session ## Code Examples ```python title="Example #1" # This code writes some data to a temporary file, and then opens that file. # Assume that the data variable holds the contents of an Excel (xls) file. filename = system.file.getTempFile("xls") system.file.writeFile(filename, data) system.net.openURL("file://" + filename) ```