English

Bug: Changes made to embedded script in a Python script tool do not persist

Description

After embedding a Python script, edits made by right-clicking the script tool and clicking 'Edit' do not persist after closing the ArcGIS session. This means that changes made in this environment are lost when closing the application.

Cause

When a script tool is accessed, it creates a temporary Python script file in a Windows Temp directory. Upon closing the application, this directory is cleared. When edits are made to the script, they are applied to the temporary file. These changes are not posted back to the original code. Therefore, any changes that are made to the script are temporary to the session and do not apply to the actual source script from which the temporary file was created. This has been documented as NIM091684.

Workaround

To make permanent changes to the source code, export the script by right-clicking it and clicking Export Script, make changes to the exported script, and import the script back if desired.

    Related Information