ID 343622 - UI4 (Qt) throws undostack.py runtime error when loading a Katana project via shelf script [Duplicate of TP 59923]

Follow

Problem summary
When loading new Katana projects through a Shelf script, if a UI4 or QtGui window us used as part of the script, it causes runtime errors with the undoStack.py

This runtime error prevents modules that would normally run in folders known to Katana in KATANA_RESOURCES to not run at all, in this case specifically to UIPlugins.

This can be an issue when expecting a 'scriptLoad' callback after launch.
 
Running the same launch script within the Python tab (reproduction steps test 2), does not throw the runtime issue.

Customer reported version
katana.2.5v7

Customer reported platform
centos7

Steps to reproduce

Test 1:

1) Setup Callback script for testing

A) Navigate to '.katana/UIPlugins' (Create folder if it does not exist)

B) Create a Python script file and open it within a IDE editor.

C) Copy the following into the script:


from Katana import Callbacksdef main():    Callbacks.addCallback(Callbacks.Type.onSceneLoad, on_sceneload)def on_sceneload(**kwargs):    print('on_scene_load callback running')    main()

D) Save the script.


2) Add the shelve script for testing

A) Navigate to '.katana/Shelves/Test_Shelves' (Create folder if it does not exist)

B) Create a Python script file and open it within a IDE editor.

C) Copy the following into the script:


"""NAME: Load_Shelve_ProjectICON: Icons/LiveGroup/Group256.pngLoad specific project file with asset file browser"""import osfrom Katana import KatanaFiledef LoadProject():     filename = UI4.Util.AssetId.BrowseForAsset('','Select Project File',False,{'fileTypes':'katana *.livegroup'})     if filename is not None:        KatanaFile.Load(filename)LoadProject()

D) Save the script.

 

3) Test the shelve script

A) Open Katana

B) Select your new Shelve option from within the Shelves ​

​​ toolbar menu

C​) Select any .katana file and press Ok.

D) Open your Terminal window

 

Result: The Katana project will load correctly, but the terminal will throw a runtime error and not print the callback command.

Test 2:

1) Follow the first step from test 1 (Copy the callback script into the '.katana/UIPlugins' location)

2) Copy the following into the Python tab within Katana:


def LoadProject():     filename = UI4.Util.AssetId.BrowseForAsset('','Select Project File',False,{'fileTypes':'katana *.livegroup'})     if filename is not None:        KatanaFile.Load(filename)LoadProject()

2) Select any .katana file and press Ok.


Result: The Katana project will load correctly, and the callback print statement will appear in the Python tab


Workaround
Unknown.

Reproduced by support

This bug has been reproduced in:
  • Katana2.6v4 - Windows 7 - CentOS6.9
  • Katana2.6v1 - Windows 7 - CentOS6.9
  • Katana2.5v7 - Windows 7 - CentOS6.9
  • Katana2.5v1 - Windows 7 - CentOS6.9
  • Katana2.1v6 - CentOS6.9
  • Katana2.1v1 - CentOS6.9
  • Katana2.0v1 - CentOS6.9

Earliest version tested
- This issue appears to be in all versions of the product

Expected behaviour
External callbacks should not run into runtime errors when launching shelve script.

Actual behaviour
Runtime errors are stopping scripts from working.
 

    We're sorry to hear that

    Please tell us why