0
votes

I'm trying to import maya.standalone in Python(IDLE). I declared the environment variable but still I'm getting the error below.

import maya.standalone ImportError: DLL load failed: The specified module could not be found.

Here's my code:

import os,sys from PyQt4 import QtCore,QtGui,uic

os.environ["MAYA_LOCATION"] = "C:\\Program Files\\Autodesk\\Maya2014" 
os.environ["PYTHONHOME"]    = "C:\\Program Files\\Autodesk\\Maya2014\\Python" 
os.environ["PATH"] = "C:\\Program Files\\Autodesk\\Maya2014\\bin;" + os.environ["PATH"]

sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\bin") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\bin\\python27.zip") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\Python") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\Python\\DLLs") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\Python\\lib") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\Python\\lib\\site-packages") 
sys.path.append("C:\\Program Files\\Autodesk\\Maya2014\\Python\\Lib\\site-packages\\maya")


import maya.standalone 
maya.standalone.initialize(name='python')

How do I fix this error?

1

1 Answers

2
votes

You have to import this module with mayapy instead of python. Add to your path "C:\Program Files\Autodesk\Maya2014\bin;"

Then in a windows command, type :

mayapy
import maya.standalone