ID 504109 - "Edit in External Editor" option with OpScripts corrupts the script and gives errors

Follow

Problem summary:

When trying to open an OpScript using an external script editor using the "Edit in External Editor" option, an error comes up and the script corrupts. 

A TypeError occurred in "ScriptEditor.py": ExternalEditSessionRegistry.externalEditStateChanged[object, str, str].emit(): argument 3 has unexpected type 'bytes'    root    2022-03-14T11:33:18
Traceback (most recent call last):
  File "FormMaster/Editors/ScriptEditor.py", line 622, in __on_externalEditButton_clicked
  File "FormMaster/Editors/ScriptEditor.py", line 618, in __endExternalEditSession
  File "FormMaster/Editors/ScriptEditor.py", line 235, in endEditingParameterExternally
  File "FormMaster/Editors/ScriptEditor.py", line 364, in __emitStateChangeSignalForEditSession
TypeError: ExternalEditSessionRegistry.externalEditStateChanged[object, str, str].emit(): argument 3 has unexpected type 'bytes'
 

Steps to reproduce:

1. Open the "OpScript Tutorial" example project

2. Set the edit flag on any OpScript node 

3. Select "Edit in External Editor"

4. Unselect "Edit in External Editor" 

This also comes up to the same result if you open the external editor, change a few things and then save it back out. 

Expected behaviour:

You should be able to edit the OpScript directly from within the Katana Parameters

Actual behaviour:

The entire OpScript is converted to a string encapsulated within b'[...]'

Workaround:

No known workaround.

Tested versions/platforms:

  • 4.5v1 - Unaffected
  • 5.0v1 - Affected

    We're sorry to hear that

    Please tell us why