Community
Arnold General Rendering Forum
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Can't import arnold module with Python 3

4 ANTWORTEN 4
Antworten
Nachricht 1 von 5
Anonymous
1060 Aufrufe, 4 Antworten

Can't import arnold module with Python 3

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.

Tags (3)
Beschriftungen (3)
4 ANTWORTEN 4
Nachricht 2 von 5
Anonymous
als Antwort auf: Anonymous

Sorry for the formatting but the text editor is extremely buggy...

Nachricht 3 von 5
Stephen.Blair
als Antwort auf: Anonymous

In ai_universe.py, change line 7 to this:

from .ai_nodes import *


// Stephen Blair
// Arnold Renderer Support
Nachricht 4 von 5
Anonymous
als Antwort auf: Anonymous

@Stephen Blair: That's not enough as the code references the ai_nodes package name later on, for instance

return NullToNone(func(universe), POINTER(ai_nodes.AtNode))

in `_AiUniverseGetOptions()`. Removing all `ai_nodes.` prefixes appears to solve the problem.

Nachricht 5 von 5
Anonymous
als Antwort auf: Anonymous

@François Beaune I solved it by changing line 7 in ai_universe.py to this, you'll have to ensure arnold is apart of your PATH environment variable:

from arnold import ai_nodes

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report