Jump to content

Py3K early access


Lorenzo Angeli

Recommended Posts

Please note, the current development status is in Beta stage and is not suitable for production.

Welcome to the ftrack-python-api tech preview for python 3.x compatibility.
Here are some brief instructions on how to start testing the upcoming release of the new API.

We strongly recommend sandboxing the testing environment using virtualenv.

Prepare your sandbox

Create a virtualenv with the Python 3 interpreter:

$ virtualenv -p `which python3.6` ~/ftrack_python_api_py3k

Activate virtualenv:

$ source ~/ftrack_python_api_py3k/bin/activate

Install

Install from the development branch:

$ pip install git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/ftrack-python-api-compatibility-with-python-3

Test

Run python from virtualenv and check that everything is in place:

(ftrack_python_api_py3k) $ python -V
(ftrack_python_api_py3k) $ Python 3.6.5


You can now start the Python interpreter and start using the API as usual.

>>> from ftrack_api import Session
>>> session = Session()
>>> projects = session.query('Project').all()
>>> print(projects)

If you need to use the Python3 and the ftrack module just run Python directly from the virtualenv using:

$ ~/ftrack_python_api_py3k/bin/python3 -c "import ftrack_api;print(ftrack_api.__version__)"



Bug reporting

Please use this thread to report issues and bugs.

When reporting bugs, please remember to include:

* Operating system in use.
* Python version in use (use: python -V).
* Full stack trace or error.

Link to comment
Share on other sites

  • 7 months later...

Installing and testing the api in Blender

  • Go to the blender's python folder (blender <version>/<version>/python/bin/)
  • Ensure pip is installed with:
    ./Python3.7m  -m ensurepip

     

  • Install the api using pip: 
    ./pip3 install git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/ftrack-python-api-compatibility-with-python-3
  • as alternative is possible to run the pip module directly from python with:
     ./python -m pip install git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/ftrack-python-api-compatibility-with-python-3
  • If you want/need to have this included in your requirements.txt you can use the the pip editable syntax as such :
    (in your requirements.txt)

     
    [...]
    someothermodule >= 0.2
    -e git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/ftrack-python-api-compatibility-with-python-3#egg=ftrack-python-api
    [...]
    


     
  • Launch Blender and open Python Console to test the api
Link to comment
Share on other sites

  • 5 months later...

We have been restarting the work on the Python api with Python3k support.
There's a new branch  ( backlog/api-2.0/story ) to use to pick the latest and greatest, and it'll be used until the official release.

Here how to update the above snippets to use it:

  • ./pip3 install git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/api-2.0/story

If you do have any question of you find any issue please let us know.

 

Link to comment
Share on other sites

Hi. 

We'll try updating to this latest branch.  We've been using the previous one for python 3 for almost a year with only one problem, that we're running into now. It's compatible with either python3 or python 2, but doesn't work in mixed environment. So if we install it with pip3 and then try loading it to maya, it crashes on multilpe wrong imports. We'll investigate more closely and post here.

Link to comment
Share on other sites

HI @Milan Kolar, Thanks for reporting it.
I wasn't aware you were already using it ! 
Be aware that some breaking changes (session won't connect automatically to the event hub) are coming soon on the story branch so be careful.

Feel free to get in touch through support to share any stack trace you might be getting.
Cheers.

L.
 

Link to comment
Share on other sites

  • 1 month later...

Thanks to all your feedback and bug reports, we are finally getting closer to a final release of the upcoming api 2.0 for python2/3 .

If you want to install (at your own risk) the latest RC2  version please use the following command:
 

 pip install ftrack-python-api==2.0.0rc2

Full change log can be found here 
please report through the usual channels any issue or bug you might be finding.

Cheers.

L.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,I run into this problem.

I tried to connect Substance with Ftrack, and now I can open Substance by Ftrack.

I tried to setup Ftrack in Substance, so I excute

"import ftrack

ftrack.setup()",

but got this Internal Server Error:

image.png.30582b1a2627ff229c69826c2e2c4032.png

I did not get any error in Maya with the same code.

How should I solve this problem?

Thanks.

Link to comment
Share on other sites

We have not updated the legacy API (module name ftrack) only the current API (module name ftrack_api).  I don't believe we plan on updating it either. Perhaps we can assist in migrating to the new API? Or you can look at the (unofficial) Blender integration since that should use only the newer API.

Link to comment
Share on other sites

  • 2 weeks later...

New RC version is out for testing.... this version introduce a better check for remote event server connection while listening to events.
you can install the new version with :

 pip install ftrack-python-api==2.0.0rc3

We are getting close to a final release,

please report any issue you may find during the RC release phase !
 

Link to comment
Share on other sites

We have a custom version of `ftrack-python-api` to use in-house because of a bug in the `websocket_client` package. I thought I would mention it here to see if it can be resolved so we don't have to maintain our own fork.

To summarize, we are using `ftrack-python-api` inside of a Deadline plugin so that Deadline renders are published automatically to Ftrack. However, when using the package we encountered persistent `SSLError: [SSL: CERTIFICATE_VERIFY_FAILED]` errors. We tracked down the root of the error to this line in `websocket_client` where the package defaults to SSL version 2.3 if no SSL version is provided in the options.

As summarized in this table, SSL versions 2 and 3 are insecure and are disabled by default in many libraries. This is why we still couldn't get the `ftrack-python-api` package to work even if we enabled SSL 2 and 3 on the Ftrack server. The crypto client libraries themselves do not support these protocols anymore by default.

In order to quickly fix this issue on our end, we opted for passing the `ssl_version` option when the EventHub WebSocket connection is being created. Our code changes this line in `ftrack-python-api/source/ftrack_api/event/hub.py` to:

self._connection = websocket.create_connection(url, timeout=60, sslopt={"ssl_version": ssl.PROTOCOL_TLS})

 

Link to comment
Share on other sites

@jen_at_floyd we are looking on adding your proposed fix (with few changes) to the api 2.0 branch.
If you want you can test this before cloning the repo , changing branch and installing it into a virtualenv.

This fix is likely to end up in the api 2.0 branch soon though, let us know in case you test.
Cheers.

L.

Link to comment
Share on other sites

Hi all,


a new RC version (4) is out for testing.... this version introduce the fix for the issue @jen_at_floyd has been reporting above about SSL connection.

You can install the new version as usual with :

 pip install ftrack-python-api==2.0.0rc4

Another step closer to the final release, please test and report if there's any issue!
Thanks.

L.

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...