"ftrack_api" in maya, No module named builtins
1 1

5 posts in this topic

Hello,

I'm starting with the ftrack_python_api and wanted to launch it from the maya script editor directly.

I followed two things I found on the forum :

  • updating  the PYTHONPATH to add my site-packages folder in env var, for exemple : PYTHONPATH = %PYTHONPATH%;C:\Users\Kombbo_05\AppData\Roaming\Python\Python39\site-packages
  • creating a virtual environment to re-install the api properly and then in Maya script editor use : import sys sys.path.insert(0, 'C:\Users\Hadrien\api-test\Lib\site-packages')

But in both cases when I try the "import ftrack_api", I've got this error :

# Error: ImportError: file C:/Users/Hadrien/api-test/Lib/site-packages\ftrack_api\session.py line 7: No module named builtins # 

It seems that the missing module is part of "future" but ftrack_api can't find it, and the strange thing is that if I launch "from future import builtins", it works...

Is there a python path to add more ? or something maybe I missed

 

Thanks for your help

Share this post


Link to post
Share on other sites

Ok so I downgraded to python 2.7.17, but it seems to have a conflict with a module in "future"

# Error: AttributeError: file C:\Python27\Lib\site-packages\future\standard_library\__init__.py line 462: 'module' object has no attribute 'getoutput' # 

And with python 3.6 I still have :

# Error: ImportError: file C:\Python36\Lib\site-packages\ftrack_api\session.py line 7: No module named builtins # 
 

I search the getoutput problem on the internet, but I didn't really find any working solution 😕

I forgot to notice I launch maya 2020

Share this post


Link to post
Share on other sites

Update on the search:

Ok, so apparently, the trouble was with the commands.py that is in C:\Python27\Lib

For some strange reason, when in maya, you type import commands, it doesn't import the commands form  C:\Python27\Lib but from somewhere else. And this other commands doesn't have the attributes.

When making a dir on it :

['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__']

So I juste copy/paste the commands.py from C:\Python27\Lib to C:\Python27\Lib\site-packages and C:\Python27\Lib\site-packages\future

and now in Maya when I try dir (commands) I get :

['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'getoutput', 'getstatus', 'getstatusoutput', 'mk2arg', 'mkarg']

And ftrack seems to works in maya 2020 python 2.7.17

I'll continue to look for a way to make it work with python 3.7 

Share this post


Link to post
Share on other sites

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
1 1