ID 432861 - Katana Developer Guide: Python code snippets on Callbacks and Events page fail to import Katana-specific Python modules

Follow

Problem summary:

There are two code snippets on the Callbacks and Events page in the Katana Developer Guide that both raise exceptions when executed in a Python tab within Katana.

Steps to reproduce:

  1. Copy the Python code snippet from the Callback Types section into a Python tab in Katana, and execute it:
    • 
      import Callbacks
      print dir(Callbacks.Type)
  2. Copy the Python code snippet from the Event Types section into a Python tab in Katana, and execute it:
    • 
      import Utils.EventModule
      print Utils.EventModule.GetAllRegisteredEventTypes()

Expected behaviour:

Imports of Katana-specific Python modules work.

Python code snippets use print() calls, not print statements.

Actual behaviour:

The import of the Callbacks module fails with an ImportError exception:


ImportError: No module named Callbacks

The import of the Utils.EventModule module fails with an ImportError exception:


ImportError: No module named Utils.EventModule

Python code snippets use print statements, not print() calls.

 

Workaround:

The Callbacks module can be imported from the "virtual" Katana module:


from Katana import Callbacks

The Utils.EventModule module can be accessed by importing the Utils module from the "virtual" Katana module:


from Katana import Utils

Tested versions/platforms:

  • 2.5v1 - Affected
  • 3.6v1 - Affected

Customer version/platform:

Not supplied

    We're sorry to hear that

    Please tell us why