ID 404622 - Crash when Python setdefaultencoding is utf-8 and Shelf Item Script throws an exception

Follow

Problem summary
Katana crashes when there's an error in a Shelf Item Script if the default encoding of Python is set to utf-8.

Customer reported version
Katana 3.1v5

Customer reported platform
Linux

Steps to reproduce

1) Add the following Python code to .katana/init.py:

import sysreload(sys)sys.setdefaultencoding('utf-8')
2) Create a Python file in the .katana/Shelves/Testing directory with the following code:

"""NAME: TESTICON: icon.pngDROP_TYPES:SCOPE:TEST test"""raise Exception('Test exception!')
3) Start Katana.
4) Run the "TEST" Shelf Item Script from the main ShelfAction (cog 
​ icon) on the main toolbar.

Notice: Katana crashes with the following error:

Traceback (most recent call last):  File "Widgets/ShelfButton.py", line 467, in go  File "Shelves.py", line 614, in run  File "/home/jesus.legaspy/.katana/Shelves/Testing/shelfCrash.py", line 9, in <module>    raise Exception('Test exception!')Exception: Test exception!./Katana3.2v1.sh: line 49: 83873 Aborted                 (core dumped) $KATANA_ROOT/katana

Expected behavior
Error is thrown, but Katana does not crash.

Actual behavior
Error is thrown and Katana crashes.

Workaround
Avoid using setdefaultencoding(), and instead use Python encoding and decoding when needed.

Reproduced by support
This bug has been reproduced in:
Katana 3.2v1 - CentOS 7, Windows 10
Katana 3.1v5 - CentOS 7, Windows 10
Katana 3.1v1 - CentOS 7, Windows 10

Unable to reproduce bug in:
Katana 3.0v9 - CentOS 7, Windows 10
Katana 3.0v1 - CentOS 7, Windows 10
Katana 2.6v1 - CentOS 7, Windows 10
Katana 2.5v1 - CentOS 7, Windows 10
Katana 2.1v1 - CentOS 7
Katana 2.0v1 - CentOS 7
Katana 1.6v3 - CentOS 7
 

    We're sorry to hear that

    Please tell us why