maya_关于脚本编辑器导入python模块


import sys

for p in sys.path:
print p

rigDir = 'C:\Users\lenovo\Documents\maya\scripts\python\rigLib'
if not rigDir in sys.path:
sys.path.append( rigDir )

from rigLib.base.control import *
ArmCtl = rigLib.base.control.Control(prefix = '1_arm')

 

问题与解决方法

# Error: line 1: 'module' object has no attribute 'base'
# Traceback (most recent call last):
# File "<maya console>", line 11, in <module>
# AttributeError: 'module' object has no attribute 'base' #

https://stackoverflow.com/questions/25575073/attributeerror-module-object-has-no-attribute-tests

 

之后再maya.env 文件中添加了PYTHONPATH = C:\Users\lenovo\Documents\maya\scripts\python

import rigLib
c = rigLib.base.control.Control()
c.Off

这样也同样可以导入模块


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM