usdpython example does not work

I installed the usdpython-0.66.pkg and also used the recommended python 3.7.9 release. Only some of the simpler sample code worked. The 103_simpleMaterial.py failed with the following error message:

Traceback (most recent call last):

  File "/Applications/usdpython/samples/103_simpleMaterial.py", line 41, in

    material.CreateSurfaceOutput().ConnectToSource(pbrShader, 'surface')

Boost.Python.ArgumentError: Python argument types in

    Output.ConnectToSource(Output, Shader, str)

did not match C++ signature:

    ConnectToSource(pxrInternal_v0_22__pxrReserved__::UsdShadeOutput {lvalue}, pxrInternal_v0_22__pxrReserved__::UsdShadeOutput sourceOutput)

    ConnectToSource(pxrInternal_v0_22__pxrReserved__::UsdShadeOutput {lvalue}, pxrInternal_v0_22__pxrReserved__::UsdShadeInput sourceInput)

    ConnectToSource(pxrInternal_v0_22__pxrReserved__::UsdShadeOutput {lvalue}, pxrInternal_v0_22__pxrReserved__::SdfPath sourcePath)

    ConnectToSource(pxrInternal_v0_22__pxrReserved__::UsdShadeOutput {lvalue}, pxrInternal_v0_22__pxrReserved__::UsdShadeConnectableAPI source, pxrInternal_v0_22__pxrReserved__::TfToken sourceName, pxrInternal_v0_22__pxrReserved__::UsdShadeAttributeType sourceType=pxr.UsdShade.AttributeType.Output, pxrInternal_v0_22__pxrReserved__::SdfValueTypeName typeName=<pxr.Sdf.ValueTypeName object at 0x7fc9702e4120>)

    ConnectToSource(pxrInternal_v0_22__pxrReserved__::UsdShadeOutput {lvalue}, pxrInternal_v0_22__pxrReserved__::UsdShadeConnectionSourceInfo source, pxrInternal_v0_22__pxrReserved__::UsdShadeConnectionModification mod=pxr.UsdShade.ConnectionModification.Replace)

It seems that the error is from the Boost.Python with mismatched parameters. Did anyone run this sample code successfully?

I just encountered this myself. There seems to have been a change in the USD API or something. Anyway, each place you see the use of the "ConnectToSource", I believe the intention is to use the 4th C++ signature here. Replace pbrShader in the referenced line (here line 41) with pbrShader.ConnectableAPI().

This seemed to fix this problem for myself in the 202_references.py script.

usdpython example does not work
 
 
Q