[Solved] Q: PyMel/PyCharm introspection setup?

python
maya

#1

Hi,

Does anyone have a winning formula for getting PyMel introspection to work in PyCharm?

I’ve tried adding any combination/order of “…/devkit/other/pymel/extras/completion/pi” and “…/python/lib/site-packages” to Interpeter Paths, but either A or B breaks

import pymel.core as pm

A.
jnt = pm.joint() # joint is known or unknown

B.
assert isinstance(jnt, pm.nt.Joint)
jnt.name() # name is a attribute of jnt or not

Thanks!


#2

While the title has to do with debugging, there is a section on setting up auto completion.


#3

Great things now work! Sorry for not finding that information myself, at least I tried… :slight_smile:

The trick was increasing the completion file size as detailed in that post. It also seems we can do better than removing Mayas site packages folder, by taking advantage of the order of the interpreter paths. This is similar to what’s done for Eclipse setup: http://help.autodesk.com/cloudhelp/2017/ENU/Maya-Tech-Docs/PyMel/eclipse.html

First remove the Maya site-packages, then add the pymel completion files, then undo the removal of the Maya site-packages.


#4

Something seems broken with 2017 though. pymel.core.nodetypes is imported into pymel.core.nt, but not according to pycharm


#5

I found this in my local copy of pymel/core/init.py

# added by J.Parks
from pymel.core.nodetypes import *
from pymel.core.datatypes import *

Perhaps that’ll help.


#6

i find with PyMel and some OpenMaya stuff you run into the intellisense filesize limits in PyCharm.
if you go into the folder that contains the PyCharm Binary you will find the idea.properties file in this just set the line

idea.max.intellisense.filesize

to something much larger than its default of 2500 kb

i generally make it something like

idea.max.intellisense.filesize=25000

#7

Is this step by step https://forums.autodesk.com/t5/maya-programming/maya-python-api-2-0-ide-code-complete/td-p/6239681 would help you with PyCharm configuration?
I think it is almost what you’ve done manually, but they followed another process by filling some configuration files, isn’t it?