Jump to content

Usage examples - Working with projects


Francois

Recommended Posts

Hi,

I'm testing some of the API usage examples.

Unfortunately, the Creating a project example does not work for me. I keep receiving this error :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "create_project_2.py", line 50, in <module>
    session.commit()
  File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1157, in commit
    result = self._call(batch)
  File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1526, in _call
    raise ftrack_api.exception.ServerError(error_message)
ftrack_api.exception.ServerError: Server reported error: ValidationError(Object type u'Shot' cannot be created on project u'projectname_1093f100dd7211e6abc88c89a5c6ef1a_full'.)

I get an identical error if I do not try to create the shots and stops at the sequence level :

	Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "create_project_2.py", line 50, in <module>
    session.commit()
  File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1157, in commit
    result = self._call(batch)
  File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1526, in _call
    raise ftrack_api.exception.ServerError(error_message)
ftrack_api.exception.ServerError: Server reported error: ValidationError(Object type u'Sequence' cannot be created on project u'projectname_765b32b0dd7111e68c4c8c89a5c6ef1a_full'.)
	

Do you have any idea of what the problem's origin could be? Could this be a setting error I have made on my Ftrack company account or in my own account?

Link to comment
Share on other sites

I've tried the example and it works for me but I suspect that the problem may be the naive querying of the ProjectSchema:

# Choose project schema.
project_schema = session.query('ProjectSchema').first()

If you have multiple Project Schemas you may get one that does not have "Shot" or "Sequence". If so you will need to filter out the one that you want to use.

Link to comment
Share on other sites

Thank you Mattias, that was indeed the issue.

The first project schema that exists in the system when you access it for the first time is the Generic schema that does not contain shots nor sequences. So, if I'm right, this means that any newcomer that has never done modifications the default schema will receive the same error when trying this API example. Wouldn't it be worth to slightly modify the Creating a project example to avoid this potential error? Or at least to add a warning to this example?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...