0

Mystic API BUG: Cannot create entity fields

Hi All,

I usually create new schema fields by using the Shotgun's Python API instead of the web user interface.

When I was trying to create new entity fields, sometimes a mystic exception occurred. It's an API problem, because I can create the entity field, which I want, on the web user interface after the creation is failed in "API style".

Here is a sample code:

    properties = {
            'name':'Delivery',
            'description':'The tracked item comes from this delivery',
            'valid_types':['Delivery'],
    }
    fname = sg.schema_field_create('CustomEntity02',  'entity',  'delivery', properties)

 

Of course, I've enabled the Delivery and CustomEntity02 entities in Site preferences before running the code printed above.

The exception is:

XMLRPC Fault 103:
API schema_field_create() invalid/missing 'type' string:
"Delivery"
Valid types: [......]

See the whole trace in the attachment!

Has somebody any idea?

Thanks in advance, Jana




sg_api_error_trace.txt

댓글 6개

  • 0
    Avatar
    János Sziliczi

    Additional interesting information: I tried to run the same code - which creates an entity field - 40 or 50 minutes after the error described above occurred.

    The unmodified code run successfully without any error message.

    Hmm, is there any scheduled background activity which needed for entity field creation after enabling the underlying entities?

  • 0
    Avatar
    KP

    János, had you just recently enabled the Delivery entity when you first tried that code? We do have a caching server running in the background but enabling the entity type should have updated the cache of valid types as soon as you enabled it. 

  • 0
    Avatar
    János Sziliczi

    Yes, I tried to create the new entity field in a few minutes after the Delivery and CustomEntity02 had been enabled.

  • 0
    Avatar
    János Sziliczi

    It seems that enabling an entity type doesn't update the cache immediately.

    A made a test: After I had enabled a new entity type on the Site Preferences page, I restarted the Shotgun instance and the memcached daemon.

    And I could create an entity field linked to the new entity type immediately from the Python API.

    This is a problem, but restarting the instance and memcached is a good workaround for it. It's good for me, so you can close this question.

    Bye, János

  • 0
    Avatar
    KP

    This should no longer be an issue. Testing shows that the cache server is handling this correctly now. If you run across it again, please let us know!

  • 0
    Avatar
    János Sziliczi

    I've just tested it and it works fine.

    Thanks a lot! - Jana

댓글을 남기려면 로그인하세요.