Message 1 of 5
Can't import arnold module with Python 3
Not applicable
08-24-2018
06:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With Arnold 5.2.0.0 that ships with Maya 2017, the following code works with Python 2.7 but fails with Python 3.6:
import os import sys sys.path.insert(0, 'C:/solidangle/mtoadeploy/2017/scripts') os.environ['PATH'] += ';C:/solidangle/mtoadeploy/2017/bin' import arnold print(arnold.AiGetVersion())
Here's the output with Python 2.7:
['5', '2', '0', '0']
and the error with Python 3.6:
Traceback (most recent call last):
File "D:\temp\test.py", line 7, in <module>
import arnold
File "C:/solidangle/mtoadeploy/2017/scripts\arnold\__init__.py", line 6, in <module>
from .ai_color_managers import *
File "C:/solidangle/mtoadeploy/2017/scripts\arnold\ai_color_managers.py", line 7, in <module>
from .ai_nodes import *
File "C:/solidangle/mtoadeploy/2017/scripts\arnold\ai_nodes.py", line 9, in <module>
from .ai_universe import AtUniverse
File "C:/solidangle/mtoadeploy/2017/scripts\arnold\ai_universe.py", line 7, in <module>
import ai_nodes
ModuleNotFoundError: No module named 'ai_nodes'
This is caused by this `import ai_nodes` statement.
Interestingly, Arnold 5.1.1.1 does not have that statement and consequently the sample code works fine with Python 3.6.