pymel / maya.cmds completion vim

374 views
Skip to first unread message

flavius

unread,
Jan 4, 2012, 3:49:04 PM1/4/12
to python_inside_maya
Looking to get pymel/maya.cmds completion in vim. Anyone get this to
work?

flavius

unread,
Jan 4, 2012, 4:27:00 PM1/4/12
to python_inside_maya
I tried adding all the paths from the mayapy shell to my PYTHONPATH.

tried import pymel in vim but got this error

:py import pymel.core

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/pymel/pymel-1.0.2/pymel/core/__init__.py", line 7, in
<module>
File "/pymel/pymel-1.0.2/pymel/internal/__init__.py", line 4, in
<module>
File "/pymel/pymel-1.0.2/pymel/internal/plogging.py", line 41, in
<module>
File "/pymel/pymel-1.0.2/pymel/internal/plogging.py", line 35, in
_fixMayaOut
put
AttributeError: 'module' object has no attribute 'Output'

flavius

unread,
Sep 26, 2012, 6:56:46 PM9/26/12
to python_in...@googlegroups.com
In case any one is still curious how to do this ...

If you are using Maya2011 and up, the generous people who brought us pymel made a skeleton maya package that you can add to your PATH:

*MAYA_INSTALL_DIR*/devkit/other/pymel/extras/completion/py/

Inside that dir there are both the maya and pymel packages.  You don't get any documentation but it's nice to have cmds autocomplete!

zbx860323

unread,
Sep 26, 2012, 9:29:54 PM9/26/12
to python_in...@googlegroups.com
"AttributeError: 'module' object has no attribute 'Output'  "

I think you use the code: XX.Output. So you got the error. You can choose one attribute to get.

And, I think mayapy and python is independent to each other, they can use independent,don't need add one to other!!
2012/9/27 flavius <fel...@gmail.com>

kevinyaya

unread,
Jan 16, 2013, 3:49:47 AM1/16/13
to python_in...@googlegroups.com
On Thursday, January 5, 2012 2:19:04 AM UTC+5:30, flavius wrote:
> Looking to get pymel/maya.cmds completion in vim. Anyone get this to
>
> work?

I still don't understand how you can get pymel autocompletion in vim. I can't find anything on the subject on the web. I didn't quite get how to use the skeleton maya package to make it work...
If you have a more complete explanation it would be nice

Cheers

Kevin

ivgr...@googlemail.com

unread,
May 7, 2014, 4:18:19 AM5/7/14
to python_in...@googlegroups.com
> I still don't understand how you can get pymel autocompletion in vim. I can't find anything on the subject on the web. I didn't quite get how to use the skeleton maya package to make it work...
> If you have a more complete explanation it would be nice

This troubled me for a while. It turned out that vim ignored the PYTHONPATH variable that i had set from the bash terminal. I got it working by appending the path inside my .vimrc like this:

" maya.cmds
:python import sys
:python sys.path.append( "/usr/autodesk/maya2014-x64/devkit/other/pymel/extras/completion/py" )

Marcus Ottosson

unread,
May 7, 2014, 5:17:10 AM5/7/14
to python_in...@googlegroups.com
Completely off-topic, but in the off chance that you aren't aware, all the cool kids use Sublime Text these days. :) If you are, I'd be interested in the benefits you see in using Vim over Sublime; besides taste, which is perfectly valid.



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d19ec0dd-ff14-427d-a165-1c66b9752676%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Nils Lerin

unread,
May 7, 2014, 3:13:20 PM5/7/14
to python_in...@googlegroups.com

Pycharm is also very nice and I belive free for personal use nowadays. Marcus, have you been able to set up debugging in sublime?

Marcus Ottosson

unread,
May 7, 2014, 3:47:27 PM5/7/14
to python_in...@googlegroups.com
Oo, how do you mean debugging? Am I missing out on something? :O The only debugging going on here are print statements and logging.

ps. I just realised this thread is about 2 years old. :)



For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
May 7, 2014, 3:55:33 PM5/7/14
to python_in...@googlegroups.com
I agree on the debugging. With python, usually my debugging consists of print statements. I use strace/GDB to attach to running processes and see what they are doing and/or stuck on, but not really for active development. But everyone has their needs I suppose, and in other languages that are compiled I am sure there are even more people that need formal debugging tools. To each, their own. 


Marcus Ottosson

unread,
May 7, 2014, 4:02:11 PM5/7/14
to python_in...@googlegroups.com
My only knowledge of Python and debugging would be pdb, although I've never investigated into what it actually does. I honestly can't see where I'd have use of any further debugging, but I'm wide open to be surprised!



For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Nils Lerin

unread,
May 7, 2014, 4:14:40 PM5/7/14
to python_in...@googlegroups.com
I've become so spoiled with debugging now that I think I would miss it alot if I switched IDE to one that doesn't have it. Especially when developing bigger tools. In pycharm you can connect to maya and set breakpoints, when it's hit you can see the entire stack trace and what data is in every variable and then step through the code. You can also execute functions at that point and return the result given the current state. I've had some problems with Pycharm 3 though and I just switched from 'Python Tools for Visual studio' that I think does this even better however it lacks some other features that pycharm has.


Marcus Ottosson

unread,
May 7, 2014, 6:12:52 PM5/7/14
to python_in...@googlegroups.com
Interesting, that sounds similar to tools within visual studio for c++, but do you think that it could also be useful outside of Maya? I'm writing for Maya too, but can't remember the last time I actually coded in the Maya interpreter. It's variable persistance is simply too much of a headache.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGkBUFdSoS%2B99tiT-X9Fz%2ByersAWJknUuY3NvnefejZkv29MKQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
Marcus Ottosson
konstr...@gmail.com


Tony Barbieri

unread,
May 7, 2014, 6:32:23 PM5/7/14
to python_in...@googlegroups.com
My time debugging usage in python is much the same as Justin's.  I've used pdb when trying to track down GC issues when using compiled python modules.  The biggest offender has been PySide/Qt.  pdb and some of the other debugging modules out there have been life savers when trying to determine why the memory count on a long living python process continued to climb over time.  I didn't use them built into an IDE though, I just used them via the command line.  I'd be surprised if SublimeText doesn't have an extension you could use.



For more options, visit https://groups.google.com/d/optout.



--
-tony

Justin Israel

unread,
May 7, 2014, 7:14:29 PM5/7/14
to python_in...@googlegroups.com
I think I played with this once for a couple hours:

It was kinda neat since it would bring up and control the sublime session as the viewer while you are stepping around the code. 




Nils Lerin

unread,
May 8, 2014, 2:53:52 AM5/8/14
to python_in...@googlegroups.com

Marcus, yes it's very similar to the tools you have for debugging in visual studio. And it's just as useful for developing externally to Maya, you can run your code directly from pycharm or Python Tools for VS in debug mode.

Another neat thing about pycharm that I don't think sublime has is that you can specify the datatype for arguments and return-type in the docstring or with one-line comments in instances where it can't figure out the type itself. It enhances the code completion quite a bit. Sorry for sounding like a salesman :p

I've never used pdb directly but that looks interesting.

Marcus Ottosson

unread,
May 8, 2014, 3:29:30 AM5/8/14
to python_in...@googlegroups.com

Hm, you mean to do stuff like contract programming?

def myfunc(arg):
    # pre-condition
    assert isinstance(arg, int)

    output = arg + 1.0

    # post-condition
    assert isinstance(arg, float)

    return output

By putting it in docstrings, you mean that it’d only be “asserted” in a “debug-mode” of sorts? The code-completion aspect of it seems interesting too.




For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Nils Lerin

unread,
May 8, 2014, 4:39:58 AM5/8/14
to python_in...@googlegroups.com

It's only used for documentation and and picked for code-completion, you won't get any asserts. It does sort of the same as python 3 argument and return type definition that as far as I know has no impact on the executed code.

Reply all
Reply to author
Forward
0 new messages