pymel.util.ModuleInterceptor

Inheritance diagram of ModuleInterceptor

class ModuleInterceptor(moduleName, callback)

This class is used to intercept an unset attribute of a module to perfrom a callback. The callback will only be performed if the attribute does not exist on the module. Any error raised in the callback will cause the original AttributeError to be raised.

def cb( module, attr):
if attr == ‘this’:
print “intercepted”
else:
raise ValueError

import sys sys.modules[__name__] = ModuleInterceptor(__name__, cb) intercepted

The class does not work when imported into the main namespace.

Previous topic

pymel.util.MatrixN

Next topic

pymel.util.MutableMapping

Core

Core Modules

Other Modules

This Page